<?xml version='1.0' encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html lang="en" xml:lang="en" xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <link href="cpip.css" rel="stylesheet" type="text/css" />
    <title>File: /Users/paulross/dev/linux/linux-3.13/kernel/cpu.c</title>
  </head>
  <body>
    <h1>File: /Users/paulross/dev/linux/linux-3.13/kernel/cpu.c</h1>
    <p>Green shading in the line number column
means the source is part of the translation unit, red means it is conditionally excluded.
Highlighted line numbers link to the translation unit page. Highlighted macros link to
the macro page.</p>
    <pre><a name="1" /><span class="True">       1:</span> <span class="k">/* CPU control.</span>
<a name="2" /><span class="True">       2:</span> <span class="k"> * (C) 2001, 2002, 2003, 2004 Rusty Russell</span>
<a name="3" /><span class="True">       3:</span> <span class="k"> *</span>
<a name="4" /><span class="True">       4:</span> <span class="k"> * This code is licenced under the GPL.</span>
<a name="5" /><span class="True">       5:</span> <span class="k"> */</span>
<a name="6" /><span class="True">       6:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">proc_fs</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="7" /><span class="True">       7:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">smp</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="8" /><span class="True">       8:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">init</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="9" /><span class="True">       9:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">notifier</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="10" /><span class="True">      10:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">sched</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="11" /><span class="True">      11:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">unistd</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="12" /><span class="True">      12:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">cpu</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="13" /><span class="True">      13:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">oom</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="14" /><span class="True">      14:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">rcupdate</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="15" /><span class="True">      15:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="m">export</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="16" /><span class="True">      16:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">bug</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="17" /><span class="True">      17:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">kthread</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="18" /><span class="True">      18:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">stop_machine</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="19" /><span class="True">      19:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">mutex</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="20" /><span class="True">      20:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">gfp</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="21" /><span class="True">      21:</span> <span class="f">#</span><span class="n">include</span> <span class="f">&lt;</span><span class="b">linux</span><span class="f">/</span><span class="b">suspend</span><span class="f">.</span><span class="b">h</span><span class="f">&gt;</span>
<a name="22" /><span class="True">      22:</span> 
<a name="23" /><span class="True">      23:</span> <span class="f">#</span><span class="n">include</span> <span class="e">&quot;smpboot.h&quot;</span>
<a name="24" /><span class="True">      24:</span> 
<a name="25" /><span class="True">      25:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX1NNUF8w"><span class="b">CONFIG_SMP</span></a>
<a name="26" /><span class="True">      26:</span> <span class="k">/* Serializes the updates to cpu_online_mask, cpu_present_mask */</span>
<a name="27" /><a href="cpu.c.html#27"><span class="True">      27:</span></a> <span class="m">static</span> <a href="cpu.c_macros_ref.html#_REVGSU5FX01VVEVYXzA_"><span class="b">DEFINE_MUTEX</span></a><span class="f">(</span><span class="b">cpu_add_remove_lock</span><span class="f">)</span><span class="f">;</span>
<a name="28" /><span class="True">      28:</span> 
<a name="29" /><span class="True">      29:</span> <span class="k">/*</span>
<a name="30" /><span class="True">      30:</span> <span class="k"> * The following two API&apos;s must be used when attempting</span>
<a name="31" /><span class="True">      31:</span> <span class="k"> * to serialize the updates to cpu_online_mask, cpu_present_mask.</span>
<a name="32" /><span class="True">      32:</span> <span class="k"> */</span>
<a name="33" /><a href="cpu.c.html#33"><span class="True">      33:</span></a> <span class="m">void</span> <span class="b">cpu_maps_update_begin</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="34" /><a href="cpu.c.html#34"><span class="True">      34:</span></a> <span class="f">{</span>
<a name="35" /><a href="cpu.c.html#35"><span class="True">      35:</span></a>     <span class="b">mutex_lock</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_add_remove_lock</span><span class="f">)</span><span class="f">;</span>
<a name="36" /><a href="cpu.c.html#36"><span class="True">      36:</span></a> <span class="f">}</span>
<a name="37" /><span class="True">      37:</span> 
<a name="38" /><a href="cpu.c.html#38"><span class="True">      38:</span></a> <span class="m">void</span> <span class="b">cpu_maps_update_done</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="39" /><a href="cpu.c.html#39"><span class="True">      39:</span></a> <span class="f">{</span>
<a name="40" /><a href="cpu.c.html#40"><span class="True">      40:</span></a>     <span class="b">mutex_unlock</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_add_remove_lock</span><span class="f">)</span><span class="f">;</span>
<a name="41" /><a href="cpu.c.html#41"><span class="True">      41:</span></a> <span class="f">}</span>
<a name="42" /><span class="True">      42:</span> 
<a name="43" /><a href="cpu.c.html#43"><span class="True">      43:</span></a> <span class="m">static</span> <a href="cpu.c_macros_ref.html#_UkFXX05PVElGSUVSX0hFQURfMA__"><span class="b">RAW_NOTIFIER_HEAD</span></a><span class="f">(</span><span class="b">cpu_chain</span><span class="f">)</span><span class="f">;</span>
<a name="44" /><span class="True">      44:</span> 
<a name="45" /><span class="True">      45:</span> <span class="k">/* If set, cpu_up and cpu_down will return -EBUSY and do nothing.</span>
<a name="46" /><span class="True">      46:</span> <span class="k"> * Should always be manipulated under cpu_add_remove_lock</span>
<a name="47" /><span class="True">      47:</span> <span class="k"> */</span>
<a name="48" /><a href="cpu.c.html#48"><span class="True">      48:</span></a> <span class="m">static</span> <span class="m">int</span> <span class="b">cpu_hotplug_disabled</span><span class="f">;</span>
<a name="49" /><span class="True">      49:</span> 
<a name="50" /><span class="True">      50:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX0hPVFBMVUdfQ1BVXzA_"><span class="b">CONFIG_HOTPLUG_CPU</span></a>
<a name="51" /><span class="True">      51:</span> 
<a name="52" /><a href="cpu.c.html#52"><span class="True">      52:</span></a> <span class="m">static</span> <span class="m">struct</span> <span class="f">{</span>
<a name="53" /><a href="cpu.c.html#53"><span class="True">      53:</span></a>     <span class="m">struct</span> <span class="b">task_struct</span> <span class="f">*</span><span class="b">active_writer</span><span class="f">;</span>
<a name="54" /><a href="cpu.c.html#54"><span class="True">      54:</span></a>     <span class="m">struct</span> <span class="b">mutex</span> <span class="b">lock</span><span class="f">;</span> <span class="k">/* Synchronizes accesses to refcount, */</span>
<a name="55" /><span class="True">      55:</span>     <span class="k">/*</span>
<a name="56" /><span class="True">      56:</span> <span class="k">     * Also blocks the new readers during</span>
<a name="57" /><span class="True">      57:</span> <span class="k">     * an ongoing cpu hotplug operation.</span>
<a name="58" /><span class="True">      58:</span> <span class="k">     */</span>
<a name="59" /><a href="cpu.c.html#59"><span class="True">      59:</span></a>     <span class="m">int</span> <span class="b">refcount</span><span class="f">;</span>
<a name="60" /><a href="cpu.c.html#60"><span class="True">      60:</span></a> <span class="f">}</span> <span class="b">cpu_hotplug</span> <span class="f">=</span> <span class="f">{</span>
<a name="61" /><a href="cpu.c.html#61"><span class="True">      61:</span></a>     <span class="f">.</span><span class="b">active_writer</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_TlVMTF8w"><span class="b">NULL</span></a><span class="f">,</span>
<a name="62" /><a href="cpu.c.html#62"><span class="True">      62:</span></a>     <span class="f">.</span><span class="b">lock</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_X19NVVRFWF9JTklUSUFMSVpFUl8w"><span class="b">__MUTEX_INITIALIZER</span></a><span class="f">(</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">lock</span><span class="f">)</span><span class="f">,</span>
<a name="63" /><a href="cpu.c.html#63"><span class="True">      63:</span></a>     <span class="f">.</span><span class="b">refcount</span> <span class="f">=</span> <span class="c">0</span><span class="f">,</span>
<a name="64" /><a href="cpu.c.html#64"><span class="True">      64:</span></a> <span class="f">}</span><span class="f">;</span>
<a name="65" /><span class="True">      65:</span> 
<a name="66" /><a href="cpu.c.html#66"><span class="True">      66:</span></a> <span class="m">void</span> <span class="b">get_online_cpus</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="67" /><a href="cpu.c.html#67"><span class="True">      67:</span></a> <span class="f">{</span>
<a name="68" /><a href="cpu.c.html#68"><span class="True">      68:</span></a>     <a href="cpu.c_macros_ref.html#_bWlnaHRfc2xlZXBfMA__"><span class="b">might_sleep</span></a><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="69" /><a href="cpu.c.html#69"><span class="True">      69:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">active_writer</span> <span class="f">==</span> <a href="cpu.c_macros_ref.html#_Y3VycmVudF8w"><span class="b">current</span></a><span class="f">)</span>
<a name="70" /><a href="cpu.c.html#70"><span class="True">      70:</span></a>         <span class="m">return</span><span class="f">;</span>
<a name="71" /><a href="cpu.c.html#71"><span class="True">      71:</span></a>     <span class="b">mutex_lock</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">lock</span><span class="f">)</span><span class="f">;</span>
<a name="72" /><a href="cpu.c.html#72"><span class="True">      72:</span></a>     <span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">refcount</span><span class="f">++</span><span class="f">;</span>
<a name="73" /><a href="cpu.c.html#73"><span class="True">      73:</span></a>     <span class="b">mutex_unlock</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">lock</span><span class="f">)</span><span class="f">;</span>
<a name="74" /><span class="True">      74:</span> 
<a name="75" /><a href="cpu.c.html#75"><span class="True">      75:</span></a> <span class="f">}</span>
<a name="76" /><a href="cpu.c.html#76"><span class="True">      76:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF9HUExfMA__"><span class="b">EXPORT_SYMBOL_GPL</span></a><span class="f">(</span><span class="b">get_online_cpus</span><span class="f">)</span><span class="f">;</span>
<a name="77" /><span class="True">      77:</span> 
<a name="78" /><a href="cpu.c.html#78"><span class="True">      78:</span></a> <span class="m">void</span> <span class="b">put_online_cpus</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="79" /><a href="cpu.c.html#79"><span class="True">      79:</span></a> <span class="f">{</span>
<a name="80" /><a href="cpu.c.html#80"><span class="True">      80:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">active_writer</span> <span class="f">==</span> <a href="cpu.c_macros_ref.html#_Y3VycmVudF8w"><span class="b">current</span></a><span class="f">)</span>
<a name="81" /><a href="cpu.c.html#81"><span class="True">      81:</span></a>         <span class="m">return</span><span class="f">;</span>
<a name="82" /><a href="cpu.c.html#82"><span class="True">      82:</span></a>     <span class="b">mutex_lock</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">lock</span><span class="f">)</span><span class="f">;</span>
<a name="83" /><span class="True">      83:</span> 
<a name="84" /><a href="cpu.c.html#84"><span class="True">      84:</span></a>     <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_V0FSTl9PTl8w"><span class="b">WARN_ON</span></a><span class="f">(</span><span class="f">!</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">refcount</span><span class="f">)</span><span class="f">)</span>
<a name="85" /><a href="cpu.c.html#85"><span class="True">      85:</span></a>         <span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">refcount</span><span class="f">++</span><span class="f">;</span> <span class="k">/* try to fix things up */</span>
<a name="86" /><span class="True">      86:</span> 
<a name="87" /><a href="cpu.c.html#87"><span class="True">      87:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="f">!</span><span class="f">--</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">refcount</span> <span class="f">&amp;&amp;</span> <a href="cpu.c_macros_ref.html#_dW5saWtlbHlfMA__"><span class="b">unlikely</span></a><span class="f">(</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">active_writer</span><span class="f">)</span><span class="f">)</span>
<a name="88" /><a href="cpu.c.html#88"><span class="True">      88:</span></a>         <span class="b">wake_up_process</span><span class="f">(</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">active_writer</span><span class="f">)</span><span class="f">;</span>
<a name="89" /><a href="cpu.c.html#89"><span class="True">      89:</span></a>     <span class="b">mutex_unlock</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">lock</span><span class="f">)</span><span class="f">;</span>
<a name="90" /><span class="True">      90:</span> 
<a name="91" /><a href="cpu.c.html#91"><span class="True">      91:</span></a> <span class="f">}</span>
<a name="92" /><a href="cpu.c.html#92"><span class="True">      92:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF9HUExfMA__"><span class="b">EXPORT_SYMBOL_GPL</span></a><span class="f">(</span><span class="b">put_online_cpus</span><span class="f">)</span><span class="f">;</span>
<a name="93" /><span class="True">      93:</span> 
<a name="94" /><span class="True">      94:</span> <span class="k">/*</span>
<a name="95" /><span class="True">      95:</span> <span class="k"> * This ensures that the hotplug operation can begin only when the</span>
<a name="96" /><span class="True">      96:</span> <span class="k"> * refcount goes to zero.</span>
<a name="97" /><span class="True">      97:</span> <span class="k"> *</span>
<a name="98" /><span class="True">      98:</span> <span class="k"> * Note that during a cpu-hotplug operation, the new readers, if any,</span>
<a name="99" /><span class="True">      99:</span> <span class="k"> * will be blocked by the cpu_hotplug.lock</span>
<a name="100" /><span class="True">     100:</span> <span class="k"> *</span>
<a name="101" /><span class="True">     101:</span> <span class="k"> * Since cpu_hotplug_begin() is always called after invoking</span>
<a name="102" /><span class="True">     102:</span> <span class="k"> * cpu_maps_update_begin(), we can be sure that only one writer is active.</span>
<a name="103" /><span class="True">     103:</span> <span class="k"> *</span>
<a name="104" /><span class="True">     104:</span> <span class="k"> * Note that theoretically, there is a possibility of a livelock:</span>
<a name="105" /><span class="True">     105:</span> <span class="k"> * - Refcount goes to zero, last reader wakes up the sleeping</span>
<a name="106" /><span class="True">     106:</span> <span class="k"> *   writer.</span>
<a name="107" /><span class="True">     107:</span> <span class="k"> * - Last reader unlocks the cpu_hotplug.lock.</span>
<a name="108" /><span class="True">     108:</span> <span class="k"> * - A new reader arrives at this moment, bumps up the refcount.</span>
<a name="109" /><span class="True">     109:</span> <span class="k"> * - The writer acquires the cpu_hotplug.lock finds the refcount</span>
<a name="110" /><span class="True">     110:</span> <span class="k"> *   non zero and goes to sleep again.</span>
<a name="111" /><span class="True">     111:</span> <span class="k"> *</span>
<a name="112" /><span class="True">     112:</span> <span class="k"> * However, this is very difficult to achieve in practice since</span>
<a name="113" /><span class="True">     113:</span> <span class="k"> * get_online_cpus() not an api which is called all that often.</span>
<a name="114" /><span class="True">     114:</span> <span class="k"> *</span>
<a name="115" /><span class="True">     115:</span> <span class="k"> */</span>
<a name="116" /><a href="cpu.c.html#116"><span class="True">     116:</span></a> <span class="m">void</span> <span class="b">cpu_hotplug_begin</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="117" /><a href="cpu.c.html#117"><span class="True">     117:</span></a> <span class="f">{</span>
<a name="118" /><a href="cpu.c.html#118"><span class="True">     118:</span></a>     <span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">active_writer</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_Y3VycmVudF8w"><span class="b">current</span></a><span class="f">;</span>
<a name="119" /><span class="True">     119:</span> 
<a name="120" /><a href="cpu.c.html#120"><span class="True">     120:</span></a>     <span class="m">for</span> <span class="f">(</span><span class="f">;</span><span class="f">;</span><span class="f">)</span> <span class="f">{</span>
<a name="121" /><a href="cpu.c.html#121"><span class="True">     121:</span></a>         <span class="b">mutex_lock</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">lock</span><span class="f">)</span><span class="f">;</span>
<a name="122" /><a href="cpu.c.html#122"><span class="True">     122:</span></a>         <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_bGlrZWx5XzA_"><span class="b">likely</span></a><span class="f">(</span><span class="f">!</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">refcount</span><span class="f">)</span><span class="f">)</span>
<a name="123" /><a href="cpu.c.html#123"><span class="True">     123:</span></a>             <span class="m">break</span><span class="f">;</span>
<a name="124" /><a href="cpu.c.html#124"><span class="True">     124:</span></a>         <a href="cpu.c_macros_ref.html#_X19zZXRfY3VycmVudF9zdGF0ZV8w"><span class="b">__set_current_state</span></a><span class="f">(</span><a href="cpu.c_macros_ref.html#_VEFTS19VTklOVEVSUlVQVElCTEVfMA__"><span class="b">TASK_UNINTERRUPTIBLE</span></a><span class="f">)</span><span class="f">;</span>
<a name="125" /><a href="cpu.c.html#125"><span class="True">     125:</span></a>         <span class="b">mutex_unlock</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">lock</span><span class="f">)</span><span class="f">;</span>
<a name="126" /><a href="cpu.c.html#126"><span class="True">     126:</span></a>         <span class="b">schedule</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="127" /><a href="cpu.c.html#127"><span class="True">     127:</span></a>     <span class="f">}</span>
<a name="128" /><a href="cpu.c.html#128"><span class="True">     128:</span></a> <span class="f">}</span>
<a name="129" /><span class="True">     129:</span> 
<a name="130" /><a href="cpu.c.html#130"><span class="True">     130:</span></a> <span class="m">void</span> <span class="b">cpu_hotplug_done</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="131" /><a href="cpu.c.html#131"><span class="True">     131:</span></a> <span class="f">{</span>
<a name="132" /><a href="cpu.c.html#132"><span class="True">     132:</span></a>     <span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">active_writer</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_TlVMTF8w"><span class="b">NULL</span></a><span class="f">;</span>
<a name="133" /><a href="cpu.c.html#133"><span class="True">     133:</span></a>     <span class="b">mutex_unlock</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_hotplug</span><span class="f">.</span><span class="b">lock</span><span class="f">)</span><span class="f">;</span>
<a name="134" /><a href="cpu.c.html#134"><span class="True">     134:</span></a> <span class="f">}</span>
<a name="135" /><span class="True">     135:</span> 
<a name="136" /><span class="True">     136:</span> <span class="k">/*</span>
<a name="137" /><span class="True">     137:</span> <span class="k"> * Wait for currently running CPU hotplug operations to complete (if any) and</span>
<a name="138" /><span class="True">     138:</span> <span class="k"> * disable future CPU hotplug (from sysfs). The &apos;cpu_add_remove_lock&apos; protects</span>
<a name="139" /><span class="True">     139:</span> <span class="k"> * the &apos;cpu_hotplug_disabled&apos; flag. The same lock is also acquired by the</span>
<a name="140" /><span class="True">     140:</span> <span class="k"> * hotplug path before performing hotplug operations. So acquiring that lock</span>
<a name="141" /><span class="True">     141:</span> <span class="k"> * guarantees mutual exclusion from any currently running hotplug operations.</span>
<a name="142" /><span class="True">     142:</span> <span class="k"> */</span>
<a name="143" /><a href="cpu.c.html#143"><span class="True">     143:</span></a> <span class="m">void</span> <span class="b">cpu_hotplug_disable</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="144" /><a href="cpu.c.html#144"><span class="True">     144:</span></a> <span class="f">{</span>
<a name="145" /><a href="cpu.c.html#145"><span class="True">     145:</span></a>     <span class="b">cpu_maps_update_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="146" /><a href="cpu.c.html#146"><span class="True">     146:</span></a>     <span class="b">cpu_hotplug_disabled</span> <span class="f">=</span> <span class="c">1</span><span class="f">;</span>
<a name="147" /><a href="cpu.c.html#147"><span class="True">     147:</span></a>     <span class="b">cpu_maps_update_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="148" /><a href="cpu.c.html#148"><span class="True">     148:</span></a> <span class="f">}</span>
<a name="149" /><span class="True">     149:</span> 
<a name="150" /><a href="cpu.c.html#150"><span class="True">     150:</span></a> <span class="m">void</span> <span class="b">cpu_hotplug_enable</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="151" /><a href="cpu.c.html#151"><span class="True">     151:</span></a> <span class="f">{</span>
<a name="152" /><a href="cpu.c.html#152"><span class="True">     152:</span></a>     <span class="b">cpu_maps_update_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="153" /><a href="cpu.c.html#153"><span class="True">     153:</span></a>     <span class="b">cpu_hotplug_disabled</span> <span class="f">=</span> <span class="c">0</span><span class="f">;</span>
<a name="154" /><a href="cpu.c.html#154"><span class="True">     154:</span></a>     <span class="b">cpu_maps_update_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="155" /><a href="cpu.c.html#155"><span class="True">     155:</span></a> <span class="f">}</span>
<a name="156" /><span class="True">     156:</span> 
<a name="157" /><span class="True">     157:</span> <span class="f">#</span><span class="n">endif</span>    <span class="k">/* CONFIG_HOTPLUG_CPU */</span>
<a name="158" /><span class="True">     158:</span> 
<a name="159" /><span class="True">     159:</span> <span class="k">/* Need to know about CPUs going up/down? */</span>
<a name="160" /><a href="cpu.c.html#160"><span class="True">     160:</span></a> <span class="m">int</span> <a href="cpu.c_macros_ref.html#_X19yZWZfMA__"><span class="b">__ref</span></a> <span class="b">register_cpu_notifier</span><span class="f">(</span><span class="m">struct</span> <span class="b">notifier_block</span> <span class="f">*</span><span class="b">nb</span><span class="f">)</span>
<a name="161" /><a href="cpu.c.html#161"><span class="True">     161:</span></a> <span class="f">{</span>
<a name="162" /><a href="cpu.c.html#162"><span class="True">     162:</span></a>     <span class="m">int</span> <span class="b">ret</span><span class="f">;</span>
<a name="163" /><a href="cpu.c.html#163"><span class="True">     163:</span></a>     <span class="b">cpu_maps_update_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="164" /><a href="cpu.c.html#164"><span class="True">     164:</span></a>     <span class="b">ret</span> <span class="f">=</span> <span class="b">raw_notifier_chain_register</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_chain</span><span class="f">,</span> <span class="b">nb</span><span class="f">)</span><span class="f">;</span>
<a name="165" /><a href="cpu.c.html#165"><span class="True">     165:</span></a>     <span class="b">cpu_maps_update_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="166" /><a href="cpu.c.html#166"><span class="True">     166:</span></a>     <span class="m">return</span> <span class="b">ret</span><span class="f">;</span>
<a name="167" /><a href="cpu.c.html#167"><span class="True">     167:</span></a> <span class="f">}</span>
<a name="168" /><span class="True">     168:</span> 
<a name="169" /><a href="cpu.c.html#169"><span class="True">     169:</span></a> <span class="m">static</span> <span class="m">int</span> <span class="b">__cpu_notify</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">val</span><span class="f">,</span> <span class="m">void</span> <span class="f">*</span><span class="b">v</span><span class="f">,</span> <span class="m">int</span> <span class="b">nr_to_call</span><span class="f">,</span>
<a name="170" /><a href="cpu.c.html#170"><span class="True">     170:</span></a>             <span class="m">int</span> <span class="f">*</span><span class="b">nr_calls</span><span class="f">)</span>
<a name="171" /><a href="cpu.c.html#171"><span class="True">     171:</span></a> <span class="f">{</span>
<a name="172" /><a href="cpu.c.html#172"><span class="True">     172:</span></a>     <span class="m">int</span> <span class="b">ret</span><span class="f">;</span>
<a name="173" /><span class="True">     173:</span> 
<a name="174" /><a href="cpu.c.html#174"><span class="True">     174:</span></a>     <span class="b">ret</span> <span class="f">=</span> <span class="b">__raw_notifier_call_chain</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_chain</span><span class="f">,</span> <span class="b">val</span><span class="f">,</span> <span class="b">v</span><span class="f">,</span> <span class="b">nr_to_call</span><span class="f">,</span>
<a name="175" /><a href="cpu.c.html#175"><span class="True">     175:</span></a>                     <span class="b">nr_calls</span><span class="f">)</span><span class="f">;</span>
<a name="176" /><span class="True">     176:</span> 
<a name="177" /><a href="cpu.c.html#177"><span class="True">     177:</span></a>     <span class="m">return</span> <span class="b">notifier_to_errno</span><span class="f">(</span><span class="b">ret</span><span class="f">)</span><span class="f">;</span>
<a name="178" /><a href="cpu.c.html#178"><span class="True">     178:</span></a> <span class="f">}</span>
<a name="179" /><span class="True">     179:</span> 
<a name="180" /><a href="cpu.c.html#180"><span class="True">     180:</span></a> <span class="m">static</span> <span class="m">int</span> <span class="b">cpu_notify</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">val</span><span class="f">,</span> <span class="m">void</span> <span class="f">*</span><span class="b">v</span><span class="f">)</span>
<a name="181" /><a href="cpu.c.html#181"><span class="True">     181:</span></a> <span class="f">{</span>
<a name="182" /><a href="cpu.c.html#182"><span class="True">     182:</span></a>     <span class="m">return</span> <span class="b">__cpu_notify</span><span class="f">(</span><span class="b">val</span><span class="f">,</span> <span class="b">v</span><span class="f">,</span> <span class="f">-</span><span class="c">1</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_TlVMTF8w"><span class="b">NULL</span></a><span class="f">)</span><span class="f">;</span>
<a name="183" /><a href="cpu.c.html#183"><span class="True">     183:</span></a> <span class="f">}</span>
<a name="184" /><span class="True">     184:</span> 
<a name="185" /><span class="True">     185:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX0hPVFBMVUdfQ1BVXzA_"><span class="b">CONFIG_HOTPLUG_CPU</span></a>
<a name="186" /><span class="True">     186:</span> 
<a name="187" /><a href="cpu.c.html#187"><span class="True">     187:</span></a> <span class="m">static</span> <span class="m">void</span> <span class="b">cpu_notify_nofail</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">long</span> <span class="b">val</span><span class="f">,</span> <span class="m">void</span> <span class="f">*</span><span class="b">v</span><span class="f">)</span>
<a name="188" /><a href="cpu.c.html#188"><span class="True">     188:</span></a> <span class="f">{</span>
<a name="189" /><a href="cpu.c.html#189"><span class="True">     189:</span></a>     <a href="cpu.c_macros_ref.html#_QlVHX09OXzA_"><span class="b">BUG_ON</span></a><span class="f">(</span><span class="b">cpu_notify</span><span class="f">(</span><span class="b">val</span><span class="f">,</span> <span class="b">v</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="190" /><a href="cpu.c.html#190"><span class="True">     190:</span></a> <span class="f">}</span>
<a name="191" /><a href="cpu.c.html#191"><span class="True">     191:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF8w"><span class="b">EXPORT_SYMBOL</span></a><span class="f">(</span><span class="b">register_cpu_notifier</span><span class="f">)</span><span class="f">;</span>
<a name="192" /><span class="True">     192:</span> 
<a name="193" /><a href="cpu.c.html#193"><span class="True">     193:</span></a> <span class="m">void</span> <a href="cpu.c_macros_ref.html#_X19yZWZfMA__"><span class="b">__ref</span></a> <span class="b">unregister_cpu_notifier</span><span class="f">(</span><span class="m">struct</span> <span class="b">notifier_block</span> <span class="f">*</span><span class="b">nb</span><span class="f">)</span>
<a name="194" /><a href="cpu.c.html#194"><span class="True">     194:</span></a> <span class="f">{</span>
<a name="195" /><a href="cpu.c.html#195"><span class="True">     195:</span></a>     <span class="b">cpu_maps_update_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="196" /><a href="cpu.c.html#196"><span class="True">     196:</span></a>     <span class="b">raw_notifier_chain_unregister</span><span class="f">(</span><span class="f">&amp;</span><span class="b">cpu_chain</span><span class="f">,</span> <span class="b">nb</span><span class="f">)</span><span class="f">;</span>
<a name="197" /><a href="cpu.c.html#197"><span class="True">     197:</span></a>     <span class="b">cpu_maps_update_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="198" /><a href="cpu.c.html#198"><span class="True">     198:</span></a> <span class="f">}</span>
<a name="199" /><a href="cpu.c.html#199"><span class="True">     199:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF8w"><span class="b">EXPORT_SYMBOL</span></a><span class="f">(</span><span class="b">unregister_cpu_notifier</span><span class="f">)</span><span class="f">;</span>
<a name="200" /><span class="True">     200:</span> 
<a name="201" /><span class="True">     201:</span> <span class="k">/**</span>
<a name="202" /><span class="True">     202:</span> <span class="k"> * clear_tasks_mm_cpumask - Safely clear tasks&apos; mm_cpumask for a CPU</span>
<a name="203" /><span class="True">     203:</span> <span class="k"> * @cpu: a CPU id</span>
<a name="204" /><span class="True">     204:</span> <span class="k"> *</span>
<a name="205" /><span class="True">     205:</span> <span class="k"> * This function walks all processes, finds a valid mm struct for each one and</span>
<a name="206" /><span class="True">     206:</span> <span class="k"> * then clears a corresponding bit in mm&apos;s cpumask.  While this all sounds</span>
<a name="207" /><span class="True">     207:</span> <span class="k"> * trivial, there are various non-obvious corner cases, which this function</span>
<a name="208" /><span class="True">     208:</span> <span class="k"> * tries to solve in a safe manner.</span>
<a name="209" /><span class="True">     209:</span> <span class="k"> *</span>
<a name="210" /><span class="True">     210:</span> <span class="k"> * Also note that the function uses a somewhat relaxed locking scheme, so it may</span>
<a name="211" /><span class="True">     211:</span> <span class="k"> * be called only for an already offlined CPU.</span>
<a name="212" /><span class="True">     212:</span> <span class="k"> */</span>
<a name="213" /><a href="cpu.c.html#213"><span class="True">     213:</span></a> <span class="m">void</span> <span class="b">clear_tasks_mm_cpumask</span><span class="f">(</span><span class="m">int</span> <span class="b">cpu</span><span class="f">)</span>
<a name="214" /><a href="cpu.c.html#214"><span class="True">     214:</span></a> <span class="f">{</span>
<a name="215" /><a href="cpu.c.html#215"><span class="True">     215:</span></a>     <span class="m">struct</span> <span class="b">task_struct</span> <span class="f">*</span><span class="b">p</span><span class="f">;</span>
<a name="216" /><span class="True">     216:</span> 
<a name="217" /><span class="True">     217:</span>     <span class="k">/*</span>
<a name="218" /><span class="True">     218:</span> <span class="k">     * This function is called after the cpu is taken down and marked</span>
<a name="219" /><span class="True">     219:</span> <span class="k">     * offline, so its not like new tasks will ever get this cpu set in</span>
<a name="220" /><span class="True">     220:</span> <span class="k">     * their mm mask. -- Peter Zijlstra</span>
<a name="221" /><span class="True">     221:</span> <span class="k">     * Thus, we may use rcu_read_lock() here, instead of grabbing</span>
<a name="222" /><span class="True">     222:</span> <span class="k">     * full-fledged tasklist_lock.</span>
<a name="223" /><span class="True">     223:</span> <span class="k">     */</span>
<a name="224" /><a href="cpu.c.html#224"><span class="True">     224:</span></a>     <a href="cpu.c_macros_ref.html#_V0FSTl9PTl8w"><span class="b">WARN_ON</span></a><span class="f">(</span><a href="cpu.c_macros_ref.html#_Y3B1X29ubGluZV8w"><span class="b">cpu_online</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="225" /><a href="cpu.c.html#225"><span class="True">     225:</span></a>     <span class="b">rcu_read_lock</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="226" /><a href="cpu.c.html#226"><span class="True">     226:</span></a>     <a href="cpu.c_macros_ref.html#_Zm9yX2VhY2hfcHJvY2Vzc18w"><span class="b">for_each_process</span></a><span class="f">(</span><span class="b">p</span><span class="f">)</span> <span class="f">{</span>
<a name="227" /><a href="cpu.c.html#227"><span class="True">     227:</span></a>         <span class="m">struct</span> <span class="b">task_struct</span> <span class="f">*</span><span class="b">t</span><span class="f">;</span>
<a name="228" /><span class="True">     228:</span> 
<a name="229" /><span class="True">     229:</span>         <span class="k">/*</span>
<a name="230" /><span class="True">     230:</span> <span class="k">         * Main thread might exit, but other threads may still have</span>
<a name="231" /><span class="True">     231:</span> <span class="k">         * a valid mm. Find one.</span>
<a name="232" /><span class="True">     232:</span> <span class="k">         */</span>
<a name="233" /><a href="cpu.c.html#233"><span class="True">     233:</span></a>         <span class="b">t</span> <span class="f">=</span> <span class="b">find_lock_task_mm</span><span class="f">(</span><span class="b">p</span><span class="f">)</span><span class="f">;</span>
<a name="234" /><a href="cpu.c.html#234"><span class="True">     234:</span></a>         <span class="m">if</span> <span class="f">(</span><span class="f">!</span><span class="b">t</span><span class="f">)</span>
<a name="235" /><a href="cpu.c.html#235"><span class="True">     235:</span></a>             <span class="m">continue</span><span class="f">;</span>
<a name="236" /><a href="cpu.c.html#236"><span class="True">     236:</span></a>         <span class="b">cpumask_clear_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <span class="b">mm_cpumask</span><span class="f">(</span><span class="b">t</span><span class="f">-&gt;</span><span class="b">mm</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="237" /><a href="cpu.c.html#237"><span class="True">     237:</span></a>         <span class="b">task_unlock</span><span class="f">(</span><span class="b">t</span><span class="f">)</span><span class="f">;</span>
<a name="238" /><a href="cpu.c.html#238"><span class="True">     238:</span></a>     <span class="f">}</span>
<a name="239" /><a href="cpu.c.html#239"><span class="True">     239:</span></a>     <span class="b">rcu_read_unlock</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="240" /><a href="cpu.c.html#240"><span class="True">     240:</span></a> <span class="f">}</span>
<a name="241" /><span class="True">     241:</span> 
<a name="242" /><a href="cpu.c.html#242"><span class="True">     242:</span></a> <span class="m">static</span> <span class="m">inline</span> <span class="m">void</span> <span class="b">check_for_tasks</span><span class="f">(</span><span class="m">int</span> <span class="b">cpu</span><span class="f">)</span>
<a name="243" /><a href="cpu.c.html#243"><span class="True">     243:</span></a> <span class="f">{</span>
<a name="244" /><a href="cpu.c.html#244"><span class="True">     244:</span></a>     <span class="m">struct</span> <span class="b">task_struct</span> <span class="f">*</span><span class="b">p</span><span class="f">;</span>
<a name="245" /><a href="cpu.c.html#245"><span class="True">     245:</span></a>     <span class="b">cputime_t</span> <span class="b">utime</span><span class="f">,</span> <span class="b">stime</span><span class="f">;</span>
<a name="246" /><span class="True">     246:</span> 
<a name="247" /><a href="cpu.c.html#247"><span class="True">     247:</span></a>     <a href="cpu.c_macros_ref.html#_d3JpdGVfbG9ja19pcnFfMA__"><span class="b">write_lock_irq</span></a><span class="f">(</span><span class="f">&amp;</span><span class="b">tasklist_lock</span><span class="f">)</span><span class="f">;</span>
<a name="248" /><a href="cpu.c.html#248"><span class="True">     248:</span></a>     <a href="cpu.c_macros_ref.html#_Zm9yX2VhY2hfcHJvY2Vzc18w"><span class="b">for_each_process</span></a><span class="f">(</span><span class="b">p</span><span class="f">)</span> <span class="f">{</span>
<a name="249" /><a href="cpu.c.html#249"><span class="True">     249:</span></a>         <span class="b">task_cputime</span><span class="f">(</span><span class="b">p</span><span class="f">,</span> <span class="f">&amp;</span><span class="b">utime</span><span class="f">,</span> <span class="f">&amp;</span><span class="b">stime</span><span class="f">)</span><span class="f">;</span>
<a name="250" /><a href="cpu.c.html#250"><span class="True">     250:</span></a>         <span class="m">if</span> <span class="f">(</span><span class="b">task_cpu</span><span class="f">(</span><span class="b">p</span><span class="f">)</span> <span class="f">==</span> <span class="b">cpu</span> <span class="f">&amp;&amp;</span> <span class="b">p</span><span class="f">-&gt;</span><span class="b">state</span> <span class="f">==</span> <a href="cpu.c_macros_ref.html#_VEFTS19SVU5OSU5HXzA_"><span class="b">TASK_RUNNING</span></a> <span class="f">&amp;&amp;</span>
<a name="251" /><a href="cpu.c.html#251"><span class="True">     251:</span></a>             <span class="f">(</span><span class="b">utime</span> <span class="f">||</span> <span class="b">stime</span><span class="f">)</span><span class="f">)</span>
<a name="252" /><a href="cpu.c.html#252"><span class="True">     252:</span></a>             <span class="b">printk</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_S0VSTl9XQVJOSU5HXzA_"><span class="b">KERN_WARNING</span></a> <span class="e">&quot;Task %s (pid = %d) is on cpu %d &quot;</span>
<a name="253" /><a href="cpu.c.html#253"><span class="True">     253:</span></a>                 <span class="e">&quot;(state = %ld, flags = %x)\n&quot;</span><span class="f">,</span>
<a name="254" /><a href="cpu.c.html#254"><span class="True">     254:</span></a>                 <span class="b">p</span><span class="f">-&gt;</span><span class="b">comm</span><span class="f">,</span> <span class="b">task_pid_nr</span><span class="f">(</span><span class="b">p</span><span class="f">)</span><span class="f">,</span> <span class="b">cpu</span><span class="f">,</span>
<a name="255" /><a href="cpu.c.html#255"><span class="True">     255:</span></a>                 <span class="b">p</span><span class="f">-&gt;</span><span class="b">state</span><span class="f">,</span> <span class="b">p</span><span class="f">-&gt;</span><span class="b">flags</span><span class="f">)</span><span class="f">;</span>
<a name="256" /><a href="cpu.c.html#256"><span class="True">     256:</span></a>     <span class="f">}</span>
<a name="257" /><a href="cpu.c.html#257"><span class="True">     257:</span></a>     <a href="cpu.c_macros_ref.html#_d3JpdGVfdW5sb2NrX2lycV8w"><span class="b">write_unlock_irq</span></a><span class="f">(</span><span class="f">&amp;</span><span class="b">tasklist_lock</span><span class="f">)</span><span class="f">;</span>
<a name="258" /><a href="cpu.c.html#258"><span class="True">     258:</span></a> <span class="f">}</span>
<a name="259" /><span class="True">     259:</span> 
<a name="260" /><a href="cpu.c.html#260"><span class="True">     260:</span></a> <span class="m">struct</span> <span class="b">take_cpu_down_param</span> <span class="f">{</span>
<a name="261" /><a href="cpu.c.html#261"><span class="True">     261:</span></a>     <span class="m">unsigned</span> <span class="m">long</span> <span class="b">mod</span><span class="f">;</span>
<a name="262" /><a href="cpu.c.html#262"><span class="True">     262:</span></a>     <span class="m">void</span> <span class="f">*</span><span class="b">hcpu</span><span class="f">;</span>
<a name="263" /><a href="cpu.c.html#263"><span class="True">     263:</span></a> <span class="f">}</span><span class="f">;</span>
<a name="264" /><span class="True">     264:</span> 
<a name="265" /><span class="True">     265:</span> <span class="k">/* Take this CPU down. */</span>
<a name="266" /><a href="cpu.c.html#266"><span class="True">     266:</span></a> <span class="m">static</span> <span class="m">int</span> <a href="cpu.c_macros_ref.html#_X19yZWZfMA__"><span class="b">__ref</span></a> <span class="b">take_cpu_down</span><span class="f">(</span><span class="m">void</span> <span class="f">*</span><span class="b">_param</span><span class="f">)</span>
<a name="267" /><a href="cpu.c.html#267"><span class="True">     267:</span></a> <span class="f">{</span>
<a name="268" /><a href="cpu.c.html#268"><span class="True">     268:</span></a>     <span class="m">struct</span> <span class="b">take_cpu_down_param</span> <span class="f">*</span><span class="b">param</span> <span class="f">=</span> <span class="b">_param</span><span class="f">;</span>
<a name="269" /><a href="cpu.c.html#269"><span class="True">     269:</span></a>     <span class="m">int</span> <span class="b">err</span><span class="f">;</span>
<a name="270" /><span class="True">     270:</span> 
<a name="271" /><span class="True">     271:</span>     <span class="k">/* Ensure this CPU doesn&apos;t handle any more interrupts. */</span>
<a name="272" /><a href="cpu.c.html#272"><span class="True">     272:</span></a>     <span class="b">err</span> <span class="f">=</span> <span class="b">__cpu_disable</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="273" /><a href="cpu.c.html#273"><span class="True">     273:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">err</span> <span class="f">&lt;</span> <span class="c">0</span><span class="f">)</span>
<a name="274" /><a href="cpu.c.html#274"><span class="True">     274:</span></a>         <span class="m">return</span> <span class="b">err</span><span class="f">;</span>
<a name="275" /><span class="True">     275:</span> 
<a name="276" /><a href="cpu.c.html#276"><span class="True">     276:</span></a>     <span class="b">cpu_notify</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Q1BVX0RZSU5HXzA_"><span class="b">CPU_DYING</span></a> <span class="f">|</span> <span class="b">param</span><span class="f">-&gt;</span><span class="b">mod</span><span class="f">,</span> <span class="b">param</span><span class="f">-&gt;</span><span class="b">hcpu</span><span class="f">)</span><span class="f">;</span>
<a name="277" /><span class="True">     277:</span>     <span class="k">/* Park the stopper thread */</span>
<a name="278" /><a href="cpu.c.html#278"><span class="True">     278:</span></a>     <span class="b">kthread_park</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Y3VycmVudF8w"><span class="b">current</span></a><span class="f">)</span><span class="f">;</span>
<a name="279" /><a href="cpu.c.html#279"><span class="True">     279:</span></a>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="280" /><a href="cpu.c.html#280"><span class="True">     280:</span></a> <span class="f">}</span>
<a name="281" /><span class="True">     281:</span> 
<a name="282" /><span class="True">     282:</span> <span class="k">/* Requires cpu_add_remove_lock to be held */</span>
<a name="283" /><a href="cpu.c.html#283"><span class="True">     283:</span></a> <span class="m">static</span> <span class="m">int</span> <a href="cpu.c_macros_ref.html#_X19yZWZfMA__"><span class="b">__ref</span></a> <span class="b">_cpu_down</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">,</span> <span class="m">int</span> <span class="b">tasks_frozen</span><span class="f">)</span>
<a name="284" /><a href="cpu.c.html#284"><span class="True">     284:</span></a> <span class="f">{</span>
<a name="285" /><a href="cpu.c.html#285"><span class="True">     285:</span></a>     <span class="m">int</span> <span class="b">err</span><span class="f">,</span> <span class="b">nr_calls</span> <span class="f">=</span> <span class="c">0</span><span class="f">;</span>
<a name="286" /><a href="cpu.c.html#286"><span class="True">     286:</span></a>     <span class="m">void</span> <span class="f">*</span><span class="b">hcpu</span> <span class="f">=</span> <span class="f">(</span><span class="m">void</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="m">long</span><span class="f">)</span><span class="b">cpu</span><span class="f">;</span>
<a name="287" /><a href="cpu.c.html#287"><span class="True">     287:</span></a>     <span class="m">unsigned</span> <span class="m">long</span> <span class="b">mod</span> <span class="f">=</span> <span class="b">tasks_frozen</span> <span class="f">?</span> <a href="cpu.c_macros_ref.html#_Q1BVX1RBU0tTX0ZST1pFTl8w"><span class="b">CPU_TASKS_FROZEN</span></a> <span class="f">:</span> <span class="c">0</span><span class="f">;</span>
<a name="288" /><a href="cpu.c.html#288"><span class="True">     288:</span></a>     <span class="m">struct</span> <span class="b">take_cpu_down_param</span> <span class="b">tcd_param</span> <span class="f">=</span> <span class="f">{</span>
<a name="289" /><a href="cpu.c.html#289"><span class="True">     289:</span></a>         <span class="f">.</span><span class="b">mod</span> <span class="f">=</span> <span class="b">mod</span><span class="f">,</span>
<a name="290" /><a href="cpu.c.html#290"><span class="True">     290:</span></a>         <span class="f">.</span><span class="b">hcpu</span> <span class="f">=</span> <span class="b">hcpu</span><span class="f">,</span>
<a name="291" /><a href="cpu.c.html#291"><span class="True">     291:</span></a>     <span class="f">}</span><span class="f">;</span>
<a name="292" /><span class="True">     292:</span> 
<a name="293" /><a href="cpu.c.html#293"><span class="True">     293:</span></a>     <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_bnVtX29ubGluZV9jcHVzXzA_"><span class="b">num_online_cpus</span></a><span class="f">(</span><span class="f">)</span> <span class="f">==</span> <span class="c">1</span><span class="f">)</span>
<a name="294" /><a href="cpu.c.html#294"><span class="True">     294:</span></a>         <span class="m">return</span> <span class="f">-</span><a href="cpu.c_macros_ref.html#_RUJVU1lfMA__"><span class="b">EBUSY</span></a><span class="f">;</span>
<a name="295" /><span class="True">     295:</span> 
<a name="296" /><a href="cpu.c.html#296"><span class="True">     296:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="f">!</span><a href="cpu.c_macros_ref.html#_Y3B1X29ubGluZV8w"><span class="b">cpu_online</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">)</span>
<a name="297" /><a href="cpu.c.html#297"><span class="True">     297:</span></a>         <span class="m">return</span> <span class="f">-</span><a href="cpu.c_macros_ref.html#_RUlOVkFMXzA_"><span class="b">EINVAL</span></a><span class="f">;</span>
<a name="298" /><span class="True">     298:</span> 
<a name="299" /><a href="cpu.c.html#299"><span class="True">     299:</span></a>     <span class="b">cpu_hotplug_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="300" /><span class="True">     300:</span> 
<a name="301" /><a href="cpu.c.html#301"><span class="True">     301:</span></a>     <span class="b">err</span> <span class="f">=</span> <span class="b">__cpu_notify</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Q1BVX0RPV05fUFJFUEFSRV8w"><span class="b">CPU_DOWN_PREPARE</span></a> <span class="f">|</span> <span class="b">mod</span><span class="f">,</span> <span class="b">hcpu</span><span class="f">,</span> <span class="f">-</span><span class="c">1</span><span class="f">,</span> <span class="f">&amp;</span><span class="b">nr_calls</span><span class="f">)</span><span class="f">;</span>
<a name="302" /><a href="cpu.c.html#302"><span class="True">     302:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">err</span><span class="f">)</span> <span class="f">{</span>
<a name="303" /><a href="cpu.c.html#303"><span class="True">     303:</span></a>         <span class="b">nr_calls</span><span class="f">--</span><span class="f">;</span>
<a name="304" /><a href="cpu.c.html#304"><span class="True">     304:</span></a>         <span class="b">__cpu_notify</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Q1BVX0RPV05fRkFJTEVEXzA_"><span class="b">CPU_DOWN_FAILED</span></a> <span class="f">|</span> <span class="b">mod</span><span class="f">,</span> <span class="b">hcpu</span><span class="f">,</span> <span class="b">nr_calls</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_TlVMTF8w"><span class="b">NULL</span></a><span class="f">)</span><span class="f">;</span>
<a name="305" /><a href="cpu.c.html#305"><span class="True">     305:</span></a>         <span class="b">printk</span><span class="f">(</span><span class="e">&quot;%s: attempt to take down CPU %u failed\n&quot;</span><span class="f">,</span>
<a name="306" /><a href="cpu.c.html#306"><span class="True">     306:</span></a>                 <span class="b">__func__</span><span class="f">,</span> <span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="307" /><a href="cpu.c.html#307"><span class="True">     307:</span></a>         <span class="m">goto</span> <span class="b">out_release</span><span class="f">;</span>
<a name="308" /><a href="cpu.c.html#308"><span class="True">     308:</span></a>     <span class="f">}</span>
<a name="309" /><span class="True">     309:</span> 
<a name="310" /><span class="True">     310:</span>     <span class="k">/*</span>
<a name="311" /><span class="True">     311:</span> <span class="k">     * By now we&apos;ve cleared cpu_active_mask, wait for all preempt-disabled</span>
<a name="312" /><span class="True">     312:</span> <span class="k">     * and RCU users of this state to go away such that all new such users</span>
<a name="313" /><span class="True">     313:</span> <span class="k">     * will observe it.</span>
<a name="314" /><span class="True">     314:</span> <span class="k">     *</span>
<a name="315" /><span class="True">     315:</span> <span class="k">     * For CONFIG_PREEMPT we have preemptible RCU and its sync_rcu() might</span>
<a name="316" /><span class="True">     316:</span> <span class="k">     * not imply sync_sched(), so explicitly call both.</span>
<a name="317" /><span class="True">     317:</span> <span class="k">     *</span>
<a name="318" /><span class="True">     318:</span> <span class="k">     * Do sync before park smpboot threads to take care the rcu boost case.</span>
<a name="319" /><span class="True">     319:</span> <span class="k">     */</span>
<a name="320" /><span class="False">     320:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_PREEMPT</span>
<a name="321" /><span class="False">     321:</span>     <span class="b">synchronize_sched</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="322" /><span class="True">     322:</span> <span class="f">#</span><span class="n">endif</span>
<a name="323" /><a href="cpu.c.html#323"><span class="True">     323:</span></a>     <span class="b">synchronize_rcu</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="324" /><span class="True">     324:</span> 
<a name="325" /><a href="cpu.c.html#325"><span class="True">     325:</span></a>     <span class="b">smpboot_park_threads</span><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="326" /><span class="True">     326:</span> 
<a name="327" /><span class="True">     327:</span>     <span class="k">/*</span>
<a name="328" /><span class="True">     328:</span> <span class="k">     * So now all preempt/rcu users must observe !cpu_active().</span>
<a name="329" /><span class="True">     329:</span> <span class="k">     */</span>
<a name="330" /><span class="True">     330:</span> 
<a name="331" /><a href="cpu.c.html#331"><span class="True">     331:</span></a>     <span class="b">err</span> <span class="f">=</span> <span class="b">__stop_machine</span><span class="f">(</span><span class="b">take_cpu_down</span><span class="f">,</span> <span class="f">&amp;</span><span class="b">tcd_param</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_Y3B1bWFza19vZl8w"><span class="b">cpumask_of</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="332" /><a href="cpu.c.html#332"><span class="True">     332:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">err</span><span class="f">)</span> <span class="f">{</span>
<a name="333" /><span class="True">     333:</span>         <span class="k">/* CPU didn&apos;t die: tell everyone.  Can&apos;t complain. */</span>
<a name="334" /><a href="cpu.c.html#334"><span class="True">     334:</span></a>         <span class="b">smpboot_unpark_threads</span><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="335" /><a href="cpu.c.html#335"><span class="True">     335:</span></a>         <span class="b">cpu_notify_nofail</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Q1BVX0RPV05fRkFJTEVEXzA_"><span class="b">CPU_DOWN_FAILED</span></a> <span class="f">|</span> <span class="b">mod</span><span class="f">,</span> <span class="b">hcpu</span><span class="f">)</span><span class="f">;</span>
<a name="336" /><a href="cpu.c.html#336"><span class="True">     336:</span></a>         <span class="m">goto</span> <span class="b">out_release</span><span class="f">;</span>
<a name="337" /><a href="cpu.c.html#337"><span class="True">     337:</span></a>     <span class="f">}</span>
<a name="338" /><a href="cpu.c.html#338"><span class="True">     338:</span></a>     <a href="cpu.c_macros_ref.html#_QlVHX09OXzA_"><span class="b">BUG_ON</span></a><span class="f">(</span><a href="cpu.c_macros_ref.html#_Y3B1X29ubGluZV8w"><span class="b">cpu_online</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="339" /><span class="True">     339:</span> 
<a name="340" /><span class="True">     340:</span>     <span class="k">/*</span>
<a name="341" /><span class="True">     341:</span> <span class="k">     * The migration_call() CPU_DYING callback will have removed all</span>
<a name="342" /><span class="True">     342:</span> <span class="k">     * runnable tasks from the cpu, there&apos;s only the idle task left now</span>
<a name="343" /><span class="True">     343:</span> <span class="k">     * that the migration thread is done doing the stop_machine thing.</span>
<a name="344" /><span class="True">     344:</span> <span class="k">     *</span>
<a name="345" /><span class="True">     345:</span> <span class="k">     * Wait for the stop thread to go away.</span>
<a name="346" /><span class="True">     346:</span> <span class="k">     */</span>
<a name="347" /><a href="cpu.c.html#347"><span class="True">     347:</span></a>     <span class="m">while</span> <span class="f">(</span><span class="f">!</span><span class="b">idle_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">)</span>
<a name="348" /><a href="cpu.c.html#348"><span class="True">     348:</span></a>         <span class="b">cpu_relax</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="349" /><span class="True">     349:</span> 
<a name="350" /><span class="True">     350:</span>     <span class="k">/* This actually kills the CPU. */</span>
<a name="351" /><a href="cpu.c.html#351"><span class="True">     351:</span></a>     <span class="b">__cpu_die</span><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="352" /><span class="True">     352:</span> 
<a name="353" /><span class="True">     353:</span>     <span class="k">/* CPU is completely dead: tell everyone.  Too late to complain. */</span>
<a name="354" /><a href="cpu.c.html#354"><span class="True">     354:</span></a>     <span class="b">cpu_notify_nofail</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Q1BVX0RFQURfMA__"><span class="b">CPU_DEAD</span></a> <span class="f">|</span> <span class="b">mod</span><span class="f">,</span> <span class="b">hcpu</span><span class="f">)</span><span class="f">;</span>
<a name="355" /><span class="True">     355:</span> 
<a name="356" /><a href="cpu.c.html#356"><span class="True">     356:</span></a>     <span class="b">check_for_tasks</span><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="357" /><span class="True">     357:</span> 
<a name="358" /><a href="cpu.c.html#358"><span class="True">     358:</span></a> <span class="b">out_release</span><span class="f">:</span>
<a name="359" /><a href="cpu.c.html#359"><span class="True">     359:</span></a>     <span class="b">cpu_hotplug_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="360" /><a href="cpu.c.html#360"><span class="True">     360:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="f">!</span><span class="b">err</span><span class="f">)</span>
<a name="361" /><a href="cpu.c.html#361"><span class="True">     361:</span></a>         <span class="b">cpu_notify_nofail</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Q1BVX1BPU1RfREVBRF8w"><span class="b">CPU_POST_DEAD</span></a> <span class="f">|</span> <span class="b">mod</span><span class="f">,</span> <span class="b">hcpu</span><span class="f">)</span><span class="f">;</span>
<a name="362" /><a href="cpu.c.html#362"><span class="True">     362:</span></a>     <span class="m">return</span> <span class="b">err</span><span class="f">;</span>
<a name="363" /><a href="cpu.c.html#363"><span class="True">     363:</span></a> <span class="f">}</span>
<a name="364" /><span class="True">     364:</span> 
<a name="365" /><a href="cpu.c.html#365"><span class="True">     365:</span></a> <span class="m">int</span> <a href="cpu.c_macros_ref.html#_X19yZWZfMA__"><span class="b">__ref</span></a> <span class="b">cpu_down</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">)</span>
<a name="366" /><a href="cpu.c.html#366"><span class="True">     366:</span></a> <span class="f">{</span>
<a name="367" /><a href="cpu.c.html#367"><span class="True">     367:</span></a>     <span class="m">int</span> <span class="b">err</span><span class="f">;</span>
<a name="368" /><span class="True">     368:</span> 
<a name="369" /><a href="cpu.c.html#369"><span class="True">     369:</span></a>     <span class="b">cpu_maps_update_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="370" /><span class="True">     370:</span> 
<a name="371" /><a href="cpu.c.html#371"><span class="True">     371:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">cpu_hotplug_disabled</span><span class="f">)</span> <span class="f">{</span>
<a name="372" /><a href="cpu.c.html#372"><span class="True">     372:</span></a>         <span class="b">err</span> <span class="f">=</span> <span class="f">-</span><a href="cpu.c_macros_ref.html#_RUJVU1lfMA__"><span class="b">EBUSY</span></a><span class="f">;</span>
<a name="373" /><a href="cpu.c.html#373"><span class="True">     373:</span></a>         <span class="m">goto</span> <span class="b">out</span><span class="f">;</span>
<a name="374" /><a href="cpu.c.html#374"><span class="True">     374:</span></a>     <span class="f">}</span>
<a name="375" /><span class="True">     375:</span> 
<a name="376" /><a href="cpu.c.html#376"><span class="True">     376:</span></a>     <span class="b">err</span> <span class="f">=</span> <span class="b">_cpu_down</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <span class="c">0</span><span class="f">)</span><span class="f">;</span>
<a name="377" /><span class="True">     377:</span> 
<a name="378" /><a href="cpu.c.html#378"><span class="True">     378:</span></a> <span class="b">out</span><span class="f">:</span>
<a name="379" /><a href="cpu.c.html#379"><span class="True">     379:</span></a>     <span class="b">cpu_maps_update_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="380" /><a href="cpu.c.html#380"><span class="True">     380:</span></a>     <span class="m">return</span> <span class="b">err</span><span class="f">;</span>
<a name="381" /><a href="cpu.c.html#381"><span class="True">     381:</span></a> <span class="f">}</span>
<a name="382" /><a href="cpu.c.html#382"><span class="True">     382:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF8w"><span class="b">EXPORT_SYMBOL</span></a><span class="f">(</span><span class="b">cpu_down</span><span class="f">)</span><span class="f">;</span>
<a name="383" /><span class="True">     383:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/*CONFIG_HOTPLUG_CPU*/</span>
<a name="384" /><span class="True">     384:</span> 
<a name="385" /><span class="True">     385:</span> <span class="k">/* Requires cpu_add_remove_lock to be held */</span>
<a name="386" /><a href="cpu.c.html#386"><span class="True">     386:</span></a> <span class="m">static</span> <span class="m">int</span> <span class="b">_cpu_up</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">,</span> <span class="m">int</span> <span class="b">tasks_frozen</span><span class="f">)</span>
<a name="387" /><a href="cpu.c.html#387"><span class="True">     387:</span></a> <span class="f">{</span>
<a name="388" /><a href="cpu.c.html#388"><span class="True">     388:</span></a>     <span class="m">int</span> <span class="b">ret</span><span class="f">,</span> <span class="b">nr_calls</span> <span class="f">=</span> <span class="c">0</span><span class="f">;</span>
<a name="389" /><a href="cpu.c.html#389"><span class="True">     389:</span></a>     <span class="m">void</span> <span class="f">*</span><span class="b">hcpu</span> <span class="f">=</span> <span class="f">(</span><span class="m">void</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="m">long</span><span class="f">)</span><span class="b">cpu</span><span class="f">;</span>
<a name="390" /><a href="cpu.c.html#390"><span class="True">     390:</span></a>     <span class="m">unsigned</span> <span class="m">long</span> <span class="b">mod</span> <span class="f">=</span> <span class="b">tasks_frozen</span> <span class="f">?</span> <a href="cpu.c_macros_ref.html#_Q1BVX1RBU0tTX0ZST1pFTl8w"><span class="b">CPU_TASKS_FROZEN</span></a> <span class="f">:</span> <span class="c">0</span><span class="f">;</span>
<a name="391" /><a href="cpu.c.html#391"><span class="True">     391:</span></a>     <span class="m">struct</span> <span class="b">task_struct</span> <span class="f">*</span><span class="b">idle</span><span class="f">;</span>
<a name="392" /><span class="True">     392:</span> 
<a name="393" /><a href="cpu.c.html#393"><span class="True">     393:</span></a>     <span class="b">cpu_hotplug_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="394" /><span class="True">     394:</span> 
<a name="395" /><a href="cpu.c.html#395"><span class="True">     395:</span></a>     <span class="m">if</span> <span class="f">(</span><a href="cpu.c_macros_ref.html#_Y3B1X29ubGluZV8w"><span class="b">cpu_online</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">)</span> <span class="f">||</span> <span class="f">!</span><a href="cpu.c_macros_ref.html#_Y3B1X3ByZXNlbnRfMA__"><span class="b">cpu_present</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">)</span> <span class="f">{</span>
<a name="396" /><a href="cpu.c.html#396"><span class="True">     396:</span></a>         <span class="b">ret</span> <span class="f">=</span> <span class="f">-</span><a href="cpu.c_macros_ref.html#_RUlOVkFMXzA_"><span class="b">EINVAL</span></a><span class="f">;</span>
<a name="397" /><a href="cpu.c.html#397"><span class="True">     397:</span></a>         <span class="m">goto</span> <span class="b">out</span><span class="f">;</span>
<a name="398" /><a href="cpu.c.html#398"><span class="True">     398:</span></a>     <span class="f">}</span>
<a name="399" /><span class="True">     399:</span> 
<a name="400" /><a href="cpu.c.html#400"><span class="True">     400:</span></a>     <span class="b">idle</span> <span class="f">=</span> <span class="b">idle_thread_get</span><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="401" /><a href="cpu.c.html#401"><span class="True">     401:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">IS_ERR</span><span class="f">(</span><span class="b">idle</span><span class="f">)</span><span class="f">)</span> <span class="f">{</span>
<a name="402" /><a href="cpu.c.html#402"><span class="True">     402:</span></a>         <span class="b">ret</span> <span class="f">=</span> <span class="b">PTR_ERR</span><span class="f">(</span><span class="b">idle</span><span class="f">)</span><span class="f">;</span>
<a name="403" /><a href="cpu.c.html#403"><span class="True">     403:</span></a>         <span class="m">goto</span> <span class="b">out</span><span class="f">;</span>
<a name="404" /><a href="cpu.c.html#404"><span class="True">     404:</span></a>     <span class="f">}</span>
<a name="405" /><span class="True">     405:</span> 
<a name="406" /><a href="cpu.c.html#406"><span class="True">     406:</span></a>     <span class="b">ret</span> <span class="f">=</span> <span class="b">smpboot_create_threads</span><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="407" /><a href="cpu.c.html#407"><span class="True">     407:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">ret</span><span class="f">)</span>
<a name="408" /><a href="cpu.c.html#408"><span class="True">     408:</span></a>         <span class="m">goto</span> <span class="b">out</span><span class="f">;</span>
<a name="409" /><span class="True">     409:</span> 
<a name="410" /><a href="cpu.c.html#410"><span class="True">     410:</span></a>     <span class="b">ret</span> <span class="f">=</span> <span class="b">__cpu_notify</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Q1BVX1VQX1BSRVBBUkVfMA__"><span class="b">CPU_UP_PREPARE</span></a> <span class="f">|</span> <span class="b">mod</span><span class="f">,</span> <span class="b">hcpu</span><span class="f">,</span> <span class="f">-</span><span class="c">1</span><span class="f">,</span> <span class="f">&amp;</span><span class="b">nr_calls</span><span class="f">)</span><span class="f">;</span>
<a name="411" /><a href="cpu.c.html#411"><span class="True">     411:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">ret</span><span class="f">)</span> <span class="f">{</span>
<a name="412" /><a href="cpu.c.html#412"><span class="True">     412:</span></a>         <span class="b">nr_calls</span><span class="f">--</span><span class="f">;</span>
<a name="413" /><a href="cpu.c.html#413"><span class="True">     413:</span></a>         <span class="b">printk</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_S0VSTl9XQVJOSU5HXzA_"><span class="b">KERN_WARNING</span></a> <span class="e">&quot;%s: attempt to bring up CPU %u failed\n&quot;</span><span class="f">,</span>
<a name="414" /><a href="cpu.c.html#414"><span class="True">     414:</span></a>                 <span class="b">__func__</span><span class="f">,</span> <span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="415" /><a href="cpu.c.html#415"><span class="True">     415:</span></a>         <span class="m">goto</span> <span class="b">out_notify</span><span class="f">;</span>
<a name="416" /><a href="cpu.c.html#416"><span class="True">     416:</span></a>     <span class="f">}</span>
<a name="417" /><span class="True">     417:</span> 
<a name="418" /><span class="True">     418:</span>     <span class="k">/* Arch-specific enabling code. */</span>
<a name="419" /><a href="cpu.c.html#419"><span class="True">     419:</span></a>     <span class="b">ret</span> <span class="f">=</span> <span class="b">__cpu_up</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <span class="b">idle</span><span class="f">)</span><span class="f">;</span>
<a name="420" /><a href="cpu.c.html#420"><span class="True">     420:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">ret</span> <span class="f">!=</span> <span class="c">0</span><span class="f">)</span>
<a name="421" /><a href="cpu.c.html#421"><span class="True">     421:</span></a>         <span class="m">goto</span> <span class="b">out_notify</span><span class="f">;</span>
<a name="422" /><a href="cpu.c.html#422"><span class="True">     422:</span></a>     <a href="cpu.c_macros_ref.html#_QlVHX09OXzA_"><span class="b">BUG_ON</span></a><span class="f">(</span><span class="f">!</span><a href="cpu.c_macros_ref.html#_Y3B1X29ubGluZV8w"><span class="b">cpu_online</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="423" /><span class="True">     423:</span> 
<a name="424" /><span class="True">     424:</span>     <span class="k">/* Wake the per cpu threads */</span>
<a name="425" /><a href="cpu.c.html#425"><span class="True">     425:</span></a>     <span class="b">smpboot_unpark_threads</span><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="426" /><span class="True">     426:</span> 
<a name="427" /><span class="True">     427:</span>     <span class="k">/* Now call notifier in preparation. */</span>
<a name="428" /><a href="cpu.c.html#428"><span class="True">     428:</span></a>     <span class="b">cpu_notify</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Q1BVX09OTElORV8w"><span class="b">CPU_ONLINE</span></a> <span class="f">|</span> <span class="b">mod</span><span class="f">,</span> <span class="b">hcpu</span><span class="f">)</span><span class="f">;</span>
<a name="429" /><span class="True">     429:</span> 
<a name="430" /><a href="cpu.c.html#430"><span class="True">     430:</span></a> <span class="b">out_notify</span><span class="f">:</span>
<a name="431" /><a href="cpu.c.html#431"><span class="True">     431:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">ret</span> <span class="f">!=</span> <span class="c">0</span><span class="f">)</span>
<a name="432" /><a href="cpu.c.html#432"><span class="True">     432:</span></a>         <span class="b">__cpu_notify</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_Q1BVX1VQX0NBTkNFTEVEXzA_"><span class="b">CPU_UP_CANCELED</span></a> <span class="f">|</span> <span class="b">mod</span><span class="f">,</span> <span class="b">hcpu</span><span class="f">,</span> <span class="b">nr_calls</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_TlVMTF8w"><span class="b">NULL</span></a><span class="f">)</span><span class="f">;</span>
<a name="433" /><a href="cpu.c.html#433"><span class="True">     433:</span></a> <span class="b">out</span><span class="f">:</span>
<a name="434" /><a href="cpu.c.html#434"><span class="True">     434:</span></a>     <span class="b">cpu_hotplug_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="435" /><span class="True">     435:</span> 
<a name="436" /><a href="cpu.c.html#436"><span class="True">     436:</span></a>     <span class="m">return</span> <span class="b">ret</span><span class="f">;</span>
<a name="437" /><a href="cpu.c.html#437"><span class="True">     437:</span></a> <span class="f">}</span>
<a name="438" /><span class="True">     438:</span> 
<a name="439" /><a href="cpu.c.html#439"><span class="True">     439:</span></a> <span class="m">int</span> <span class="b">cpu_up</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">)</span>
<a name="440" /><a href="cpu.c.html#440"><span class="True">     440:</span></a> <span class="f">{</span>
<a name="441" /><a href="cpu.c.html#441"><span class="True">     441:</span></a>     <span class="m">int</span> <span class="b">err</span> <span class="f">=</span> <span class="c">0</span><span class="f">;</span>
<a name="442" /><span class="True">     442:</span> 
<a name="443" /><a href="cpu.c.html#443"><span class="True">     443:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="f">!</span><a href="cpu.c_macros_ref.html#_Y3B1X3Bvc3NpYmxlXzA_"><span class="b">cpu_possible</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">)</span> <span class="f">{</span>
<a name="444" /><a href="cpu.c.html#444"><span class="True">     444:</span></a>         <span class="b">printk</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_S0VSTl9FUlJfMA__"><span class="b">KERN_ERR</span></a> <span class="e">&quot;can&apos;t online cpu %d because it is not &quot;</span>
<a name="445" /><a href="cpu.c.html#445"><span class="True">     445:</span></a>             <span class="e">&quot;configured as may-hotadd at boot time\n&quot;</span><span class="f">,</span> <span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="446" /><span class="False">     446:</span> <span class="f">#</span><span class="n">if</span> <span class="b">defined</span><span class="f">(</span><span class="b">CONFIG_IA64</span><span class="f">)</span>
<a name="447" /><span class="False">     447:</span>         <span class="b">printk</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_S0VSTl9FUlJfMA__"><span class="b">KERN_ERR</span></a> <span class="e">&quot;please check additional_cpus= boot &quot;</span>
<a name="448" /><span class="False">     448:</span>                 <span class="e">&quot;parameter\n&quot;</span><span class="f">)</span><span class="f">;</span>
<a name="449" /><span class="True">     449:</span> <span class="f">#</span><span class="n">endif</span>
<a name="450" /><a href="cpu.c.html#450"><span class="True">     450:</span></a>         <span class="m">return</span> <span class="f">-</span><a href="cpu.c_macros_ref.html#_RUlOVkFMXzA_"><span class="b">EINVAL</span></a><span class="f">;</span>
<a name="451" /><a href="cpu.c.html#451"><span class="True">     451:</span></a>     <span class="f">}</span>
<a name="452" /><span class="True">     452:</span> 
<a name="453" /><a href="cpu.c.html#453"><span class="True">     453:</span></a>     <span class="b">err</span> <span class="f">=</span> <span class="b">try_online_node</span><span class="f">(</span><span class="b">cpu_to_node</span><span class="f">(</span><span class="b">cpu</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="454" /><a href="cpu.c.html#454"><span class="True">     454:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">err</span><span class="f">)</span>
<a name="455" /><a href="cpu.c.html#455"><span class="True">     455:</span></a>         <span class="m">return</span> <span class="b">err</span><span class="f">;</span>
<a name="456" /><span class="True">     456:</span> 
<a name="457" /><a href="cpu.c.html#457"><span class="True">     457:</span></a>     <span class="b">cpu_maps_update_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="458" /><span class="True">     458:</span> 
<a name="459" /><a href="cpu.c.html#459"><span class="True">     459:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">cpu_hotplug_disabled</span><span class="f">)</span> <span class="f">{</span>
<a name="460" /><a href="cpu.c.html#460"><span class="True">     460:</span></a>         <span class="b">err</span> <span class="f">=</span> <span class="f">-</span><a href="cpu.c_macros_ref.html#_RUJVU1lfMA__"><span class="b">EBUSY</span></a><span class="f">;</span>
<a name="461" /><a href="cpu.c.html#461"><span class="True">     461:</span></a>         <span class="m">goto</span> <span class="b">out</span><span class="f">;</span>
<a name="462" /><a href="cpu.c.html#462"><span class="True">     462:</span></a>     <span class="f">}</span>
<a name="463" /><span class="True">     463:</span> 
<a name="464" /><a href="cpu.c.html#464"><span class="True">     464:</span></a>     <span class="b">err</span> <span class="f">=</span> <span class="b">_cpu_up</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <span class="c">0</span><span class="f">)</span><span class="f">;</span>
<a name="465" /><span class="True">     465:</span> 
<a name="466" /><a href="cpu.c.html#466"><span class="True">     466:</span></a> <span class="b">out</span><span class="f">:</span>
<a name="467" /><a href="cpu.c.html#467"><span class="True">     467:</span></a>     <span class="b">cpu_maps_update_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="468" /><a href="cpu.c.html#468"><span class="True">     468:</span></a>     <span class="m">return</span> <span class="b">err</span><span class="f">;</span>
<a name="469" /><a href="cpu.c.html#469"><span class="True">     469:</span></a> <span class="f">}</span>
<a name="470" /><a href="cpu.c.html#470"><span class="True">     470:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF9HUExfMA__"><span class="b">EXPORT_SYMBOL_GPL</span></a><span class="f">(</span><span class="b">cpu_up</span><span class="f">)</span><span class="f">;</span>
<a name="471" /><span class="True">     471:</span> 
<a name="472" /><span class="True">     472:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX1BNX1NMRUVQX1NNUF8w"><span class="b">CONFIG_PM_SLEEP_SMP</span></a>
<a name="473" /><a href="cpu.c.html#473"><span class="True">     473:</span></a> <span class="m">static</span> <span class="b">cpumask_var_t</span> <span class="b">frozen_cpus</span><span class="f">;</span>
<a name="474" /><span class="True">     474:</span> 
<a name="475" /><a href="cpu.c.html#475"><span class="True">     475:</span></a> <span class="m">int</span> <span class="b">disable_nonboot_cpus</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="476" /><a href="cpu.c.html#476"><span class="True">     476:</span></a> <span class="f">{</span>
<a name="477" /><a href="cpu.c.html#477"><span class="True">     477:</span></a>     <span class="m">int</span> <span class="b">cpu</span><span class="f">,</span> <a href="cpu.c_macros_noref.html#_Zmlyc3RfY3B1XzA_"><span class="b">first_cpu</span></a><span class="f">,</span> <span class="b">error</span> <span class="f">=</span> <span class="c">0</span><span class="f">;</span>
<a name="478" /><span class="True">     478:</span> 
<a name="479" /><a href="cpu.c.html#479"><span class="True">     479:</span></a>     <span class="b">cpu_maps_update_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="480" /><a href="cpu.c.html#480"><span class="True">     480:</span></a>     <a href="cpu.c_macros_noref.html#_Zmlyc3RfY3B1XzA_"><span class="b">first_cpu</span></a> <span class="f">=</span> <span class="b">cpumask_first</span><span class="f">(</span><span class="b">cpu_online_mask</span><span class="f">)</span><span class="f">;</span>
<a name="481" /><span class="True">     481:</span>     <span class="k">/*</span>
<a name="482" /><span class="True">     482:</span> <span class="k">     * We take down all of the non-boot CPUs in one shot to avoid races</span>
<a name="483" /><span class="True">     483:</span> <span class="k">     * with the userspace trying to use the CPU hotplug at the same time</span>
<a name="484" /><span class="True">     484:</span> <span class="k">     */</span>
<a name="485" /><a href="cpu.c.html#485"><span class="True">     485:</span></a>     <span class="b">cpumask_clear</span><span class="f">(</span><span class="b">frozen_cpus</span><span class="f">)</span><span class="f">;</span>
<a name="486" /><span class="True">     486:</span> 
<a name="487" /><a href="cpu.c.html#487"><span class="True">     487:</span></a>     <span class="b">printk</span><span class="f">(</span><span class="e">&quot;Disabling non-boot CPUs ...\n&quot;</span><span class="f">)</span><span class="f">;</span>
<a name="488" /><a href="cpu.c.html#488"><span class="True">     488:</span></a>     <a href="cpu.c_macros_ref.html#_Zm9yX2VhY2hfb25saW5lX2NwdV8w"><span class="b">for_each_online_cpu</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">)</span> <span class="f">{</span>
<a name="489" /><a href="cpu.c.html#489"><span class="True">     489:</span></a>         <span class="m">if</span> <span class="f">(</span><span class="b">cpu</span> <span class="f">==</span> <a href="cpu.c_macros_noref.html#_Zmlyc3RfY3B1XzA_"><span class="b">first_cpu</span></a><span class="f">)</span>
<a name="490" /><a href="cpu.c.html#490"><span class="True">     490:</span></a>             <span class="m">continue</span><span class="f">;</span>
<a name="491" /><a href="cpu.c.html#491"><span class="True">     491:</span></a>         <span class="b">error</span> <span class="f">=</span> <span class="b">_cpu_down</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <span class="c">1</span><span class="f">)</span><span class="f">;</span>
<a name="492" /><a href="cpu.c.html#492"><span class="True">     492:</span></a>         <span class="m">if</span> <span class="f">(</span><span class="f">!</span><span class="b">error</span><span class="f">)</span>
<a name="493" /><a href="cpu.c.html#493"><span class="True">     493:</span></a>             <span class="b">cpumask_set_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <span class="b">frozen_cpus</span><span class="f">)</span><span class="f">;</span>
<a name="494" /><a href="cpu.c.html#494"><span class="True">     494:</span></a>         <span class="m">else</span> <span class="f">{</span>
<a name="495" /><a href="cpu.c.html#495"><span class="True">     495:</span></a>             <span class="b">printk</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_S0VSTl9FUlJfMA__"><span class="b">KERN_ERR</span></a> <span class="e">&quot;Error taking CPU%d down: %d\n&quot;</span><span class="f">,</span>
<a name="496" /><a href="cpu.c.html#496"><span class="True">     496:</span></a>                 <span class="b">cpu</span><span class="f">,</span> <span class="b">error</span><span class="f">)</span><span class="f">;</span>
<a name="497" /><a href="cpu.c.html#497"><span class="True">     497:</span></a>             <span class="m">break</span><span class="f">;</span>
<a name="498" /><a href="cpu.c.html#498"><span class="True">     498:</span></a>         <span class="f">}</span>
<a name="499" /><a href="cpu.c.html#499"><span class="True">     499:</span></a>     <span class="f">}</span>
<a name="500" /><span class="True">     500:</span> 
<a name="501" /><a href="cpu.c.html#501"><span class="True">     501:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="f">!</span><span class="b">error</span><span class="f">)</span> <span class="f">{</span>
<a name="502" /><a href="cpu.c.html#502"><span class="True">     502:</span></a>         <a href="cpu.c_macros_ref.html#_QlVHX09OXzA_"><span class="b">BUG_ON</span></a><span class="f">(</span><a href="cpu.c_macros_ref.html#_bnVtX29ubGluZV9jcHVzXzA_"><span class="b">num_online_cpus</span></a><span class="f">(</span><span class="f">)</span> <span class="f">&gt;</span> <span class="c">1</span><span class="f">)</span><span class="f">;</span>
<a name="503" /><span class="True">     503:</span>         <span class="k">/* Make sure the CPUs won&apos;t be enabled by someone else */</span>
<a name="504" /><a href="cpu.c.html#504"><span class="True">     504:</span></a>         <span class="b">cpu_hotplug_disabled</span> <span class="f">=</span> <span class="c">1</span><span class="f">;</span>
<a name="505" /><a href="cpu.c.html#505"><span class="True">     505:</span></a>     <span class="f">}</span> <span class="m">else</span> <span class="f">{</span>
<a name="506" /><a href="cpu.c.html#506"><span class="True">     506:</span></a>         <span class="b">printk</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_S0VSTl9FUlJfMA__"><span class="b">KERN_ERR</span></a> <span class="e">&quot;Non-boot CPUs are not disabled\n&quot;</span><span class="f">)</span><span class="f">;</span>
<a name="507" /><a href="cpu.c.html#507"><span class="True">     507:</span></a>     <span class="f">}</span>
<a name="508" /><a href="cpu.c.html#508"><span class="True">     508:</span></a>     <span class="b">cpu_maps_update_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="509" /><a href="cpu.c.html#509"><span class="True">     509:</span></a>     <span class="m">return</span> <span class="b">error</span><span class="f">;</span>
<a name="510" /><a href="cpu.c.html#510"><span class="True">     510:</span></a> <span class="f">}</span>
<a name="511" /><span class="True">     511:</span> 
<a name="512" /><a href="cpu.c.html#512"><span class="True">     512:</span></a> <span class="m">void</span> <a href="cpu.c_macros_ref.html#_X193ZWFrXzA_"><span class="b">__weak</span></a> <span class="b">arch_enable_nonboot_cpus_begin</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="513" /><a href="cpu.c.html#513"><span class="True">     513:</span></a> <span class="f">{</span>
<a name="514" /><a href="cpu.c.html#514"><span class="True">     514:</span></a> <span class="f">}</span>
<a name="515" /><span class="True">     515:</span> 
<a name="516" /><a href="cpu.c.html#516"><span class="True">     516:</span></a> <span class="m">void</span> <a href="cpu.c_macros_ref.html#_X193ZWFrXzA_"><span class="b">__weak</span></a> <span class="b">arch_enable_nonboot_cpus_end</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="517" /><a href="cpu.c.html#517"><span class="True">     517:</span></a> <span class="f">{</span>
<a name="518" /><a href="cpu.c.html#518"><span class="True">     518:</span></a> <span class="f">}</span>
<a name="519" /><span class="True">     519:</span> 
<a name="520" /><a href="cpu.c.html#520"><span class="True">     520:</span></a> <span class="m">void</span> <a href="cpu.c_macros_ref.html#_X19yZWZfMA__"><span class="b">__ref</span></a> <span class="b">enable_nonboot_cpus</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="521" /><a href="cpu.c.html#521"><span class="True">     521:</span></a> <span class="f">{</span>
<a name="522" /><a href="cpu.c.html#522"><span class="True">     522:</span></a>     <span class="m">int</span> <span class="b">cpu</span><span class="f">,</span> <span class="b">error</span><span class="f">;</span>
<a name="523" /><span class="True">     523:</span> 
<a name="524" /><span class="True">     524:</span>     <span class="k">/* Allow everyone to use the CPU hotplug again */</span>
<a name="525" /><a href="cpu.c.html#525"><span class="True">     525:</span></a>     <span class="b">cpu_maps_update_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="526" /><a href="cpu.c.html#526"><span class="True">     526:</span></a>     <span class="b">cpu_hotplug_disabled</span> <span class="f">=</span> <span class="c">0</span><span class="f">;</span>
<a name="527" /><a href="cpu.c.html#527"><span class="True">     527:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">cpumask_empty</span><span class="f">(</span><span class="b">frozen_cpus</span><span class="f">)</span><span class="f">)</span>
<a name="528" /><a href="cpu.c.html#528"><span class="True">     528:</span></a>         <span class="m">goto</span> <span class="b">out</span><span class="f">;</span>
<a name="529" /><span class="True">     529:</span> 
<a name="530" /><a href="cpu.c.html#530"><span class="True">     530:</span></a>     <span class="b">printk</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_S0VSTl9JTkZPXzA_"><span class="b">KERN_INFO</span></a> <span class="e">&quot;Enabling non-boot CPUs ...\n&quot;</span><span class="f">)</span><span class="f">;</span>
<a name="531" /><span class="True">     531:</span> 
<a name="532" /><a href="cpu.c.html#532"><span class="True">     532:</span></a>     <span class="b">arch_enable_nonboot_cpus_begin</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="533" /><span class="True">     533:</span> 
<a name="534" /><a href="cpu.c.html#534"><span class="True">     534:</span></a>     <a href="cpu.c_macros_ref.html#_Zm9yX2VhY2hfY3B1XzA_"><span class="b">for_each_cpu</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <span class="b">frozen_cpus</span><span class="f">)</span> <span class="f">{</span>
<a name="535" /><a href="cpu.c.html#535"><span class="True">     535:</span></a>         <span class="b">error</span> <span class="f">=</span> <span class="b">_cpu_up</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <span class="c">1</span><span class="f">)</span><span class="f">;</span>
<a name="536" /><a href="cpu.c.html#536"><span class="True">     536:</span></a>         <span class="m">if</span> <span class="f">(</span><span class="f">!</span><span class="b">error</span><span class="f">)</span> <span class="f">{</span>
<a name="537" /><a href="cpu.c.html#537"><span class="True">     537:</span></a>             <span class="b">printk</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_S0VSTl9JTkZPXzA_"><span class="b">KERN_INFO</span></a> <span class="e">&quot;CPU%d is up\n&quot;</span><span class="f">,</span> <span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="538" /><a href="cpu.c.html#538"><span class="True">     538:</span></a>             <span class="m">continue</span><span class="f">;</span>
<a name="539" /><a href="cpu.c.html#539"><span class="True">     539:</span></a>         <span class="f">}</span>
<a name="540" /><a href="cpu.c.html#540"><span class="True">     540:</span></a>         <span class="b">printk</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_S0VSTl9XQVJOSU5HXzA_"><span class="b">KERN_WARNING</span></a> <span class="e">&quot;Error taking CPU%d up: %d\n&quot;</span><span class="f">,</span> <span class="b">cpu</span><span class="f">,</span> <span class="b">error</span><span class="f">)</span><span class="f">;</span>
<a name="541" /><a href="cpu.c.html#541"><span class="True">     541:</span></a>     <span class="f">}</span>
<a name="542" /><span class="True">     542:</span> 
<a name="543" /><a href="cpu.c.html#543"><span class="True">     543:</span></a>     <span class="b">arch_enable_nonboot_cpus_end</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="544" /><span class="True">     544:</span> 
<a name="545" /><a href="cpu.c.html#545"><span class="True">     545:</span></a>     <span class="b">cpumask_clear</span><span class="f">(</span><span class="b">frozen_cpus</span><span class="f">)</span><span class="f">;</span>
<a name="546" /><a href="cpu.c.html#546"><span class="True">     546:</span></a> <span class="b">out</span><span class="f">:</span>
<a name="547" /><a href="cpu.c.html#547"><span class="True">     547:</span></a>     <span class="b">cpu_maps_update_done</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="548" /><a href="cpu.c.html#548"><span class="True">     548:</span></a> <span class="f">}</span>
<a name="549" /><span class="True">     549:</span> 
<a name="550" /><a href="cpu.c.html#550"><span class="True">     550:</span></a> <span class="m">static</span> <span class="m">int</span> <a href="cpu.c_macros_ref.html#_X19pbml0XzA_"><span class="b">__init</span></a> <span class="b">alloc_frozen_cpus</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="551" /><a href="cpu.c.html#551"><span class="True">     551:</span></a> <span class="f">{</span>
<a name="552" /><a href="cpu.c.html#552"><span class="True">     552:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="f">!</span><span class="b">alloc_cpumask_var</span><span class="f">(</span><span class="f">&amp;</span><span class="b">frozen_cpus</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_R0ZQX0tFUk5FTF8w"><span class="b">GFP_KERNEL</span></a><span class="f">|</span><a href="cpu.c_macros_ref.html#_X19HRlBfWkVST18w"><span class="b">__GFP_ZERO</span></a><span class="f">)</span><span class="f">)</span>
<a name="553" /><a href="cpu.c.html#553"><span class="True">     553:</span></a>         <span class="m">return</span> <span class="f">-</span><a href="cpu.c_macros_ref.html#_RU5PTUVNXzA_"><span class="b">ENOMEM</span></a><span class="f">;</span>
<a name="554" /><a href="cpu.c.html#554"><span class="True">     554:</span></a>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="555" /><a href="cpu.c.html#555"><span class="True">     555:</span></a> <span class="f">}</span>
<a name="556" /><a href="cpu.c.html#556"><span class="True">     556:</span></a> <a href="cpu.c_macros_ref.html#_Y29yZV9pbml0Y2FsbF8w"><span class="b">core_initcall</span></a><span class="f">(</span><span class="b">alloc_frozen_cpus</span><span class="f">)</span><span class="f">;</span>
<a name="557" /><span class="True">     557:</span> 
<a name="558" /><span class="True">     558:</span> <span class="k">/*</span>
<a name="559" /><span class="True">     559:</span> <span class="k"> * When callbacks for CPU hotplug notifications are being executed, we must</span>
<a name="560" /><span class="True">     560:</span> <span class="k"> * ensure that the state of the system with respect to the tasks being frozen</span>
<a name="561" /><span class="True">     561:</span> <span class="k"> * or not, as reported by the notification, remains unchanged *throughout the</span>
<a name="562" /><span class="True">     562:</span> <span class="k"> * duration* of the execution of the callbacks.</span>
<a name="563" /><span class="True">     563:</span> <span class="k"> * Hence we need to prevent the freezer from racing with regular CPU hotplug.</span>
<a name="564" /><span class="True">     564:</span> <span class="k"> *</span>
<a name="565" /><span class="True">     565:</span> <span class="k"> * This synchronization is implemented by mutually excluding regular CPU</span>
<a name="566" /><span class="True">     566:</span> <span class="k"> * hotplug and Suspend/Hibernate call paths by hooking onto the Suspend/</span>
<a name="567" /><span class="True">     567:</span> <span class="k"> * Hibernate notifications.</span>
<a name="568" /><span class="True">     568:</span> <span class="k"> */</span>
<a name="569" /><a href="cpu.c.html#569"><span class="True">     569:</span></a> <span class="m">static</span> <span class="m">int</span>
<a name="570" /><a href="cpu.c.html#570"><span class="True">     570:</span></a> <span class="b">cpu_hotplug_pm_callback</span><span class="f">(</span><span class="m">struct</span> <span class="b">notifier_block</span> <span class="f">*</span><span class="b">nb</span><span class="f">,</span>
<a name="571" /><a href="cpu.c.html#571"><span class="True">     571:</span></a>             <span class="m">unsigned</span> <span class="m">long</span> <span class="b">action</span><span class="f">,</span> <span class="m">void</span> <span class="f">*</span><span class="b">ptr</span><span class="f">)</span>
<a name="572" /><a href="cpu.c.html#572"><span class="True">     572:</span></a> <span class="f">{</span>
<a name="573" /><a href="cpu.c.html#573"><span class="True">     573:</span></a>     <span class="m">switch</span> <span class="f">(</span><span class="b">action</span><span class="f">)</span> <span class="f">{</span>
<a name="574" /><span class="True">     574:</span> 
<a name="575" /><a href="cpu.c.html#575"><span class="True">     575:</span></a>     <span class="m">case</span> <a href="cpu.c_macros_ref.html#_UE1fU1VTUEVORF9QUkVQQVJFXzA_"><span class="b">PM_SUSPEND_PREPARE</span></a><span class="f">:</span>
<a name="576" /><a href="cpu.c.html#576"><span class="True">     576:</span></a>     <span class="m">case</span> <a href="cpu.c_macros_ref.html#_UE1fSElCRVJOQVRJT05fUFJFUEFSRV8w"><span class="b">PM_HIBERNATION_PREPARE</span></a><span class="f">:</span>
<a name="577" /><a href="cpu.c.html#577"><span class="True">     577:</span></a>         <span class="b">cpu_hotplug_disable</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="578" /><a href="cpu.c.html#578"><span class="True">     578:</span></a>         <span class="m">break</span><span class="f">;</span>
<a name="579" /><span class="True">     579:</span> 
<a name="580" /><a href="cpu.c.html#580"><span class="True">     580:</span></a>     <span class="m">case</span> <a href="cpu.c_macros_ref.html#_UE1fUE9TVF9TVVNQRU5EXzA_"><span class="b">PM_POST_SUSPEND</span></a><span class="f">:</span>
<a name="581" /><a href="cpu.c.html#581"><span class="True">     581:</span></a>     <span class="m">case</span> <a href="cpu.c_macros_ref.html#_UE1fUE9TVF9ISUJFUk5BVElPTl8w"><span class="b">PM_POST_HIBERNATION</span></a><span class="f">:</span>
<a name="582" /><a href="cpu.c.html#582"><span class="True">     582:</span></a>         <span class="b">cpu_hotplug_enable</span><span class="f">(</span><span class="f">)</span><span class="f">;</span>
<a name="583" /><a href="cpu.c.html#583"><span class="True">     583:</span></a>         <span class="m">break</span><span class="f">;</span>
<a name="584" /><span class="True">     584:</span> 
<a name="585" /><a href="cpu.c.html#585"><span class="True">     585:</span></a>     <span class="m">default</span><span class="f">:</span>
<a name="586" /><a href="cpu.c.html#586"><span class="True">     586:</span></a>         <span class="m">return</span> <a href="cpu.c_macros_ref.html#_Tk9USUZZX0RPTkVfMA__"><span class="b">NOTIFY_DONE</span></a><span class="f">;</span>
<a name="587" /><a href="cpu.c.html#587"><span class="True">     587:</span></a>     <span class="f">}</span>
<a name="588" /><span class="True">     588:</span> 
<a name="589" /><a href="cpu.c.html#589"><span class="True">     589:</span></a>     <span class="m">return</span> <a href="cpu.c_macros_ref.html#_Tk9USUZZX09LXzA_"><span class="b">NOTIFY_OK</span></a><span class="f">;</span>
<a name="590" /><a href="cpu.c.html#590"><span class="True">     590:</span></a> <span class="f">}</span>
<a name="591" /><span class="True">     591:</span> 
<a name="592" /><span class="True">     592:</span> 
<a name="593" /><a href="cpu.c.html#593"><span class="True">     593:</span></a> <span class="m">static</span> <span class="m">int</span> <a href="cpu.c_macros_ref.html#_X19pbml0XzA_"><span class="b">__init</span></a> <span class="b">cpu_hotplug_pm_sync_init</span><span class="f">(</span><span class="m">void</span><span class="f">)</span>
<a name="594" /><a href="cpu.c.html#594"><span class="True">     594:</span></a> <span class="f">{</span>
<a name="595" /><span class="True">     595:</span>     <span class="k">/*</span>
<a name="596" /><span class="True">     596:</span> <span class="k">     * cpu_hotplug_pm_callback has higher priority than x86</span>
<a name="597" /><span class="True">     597:</span> <span class="k">     * bsp_pm_callback which depends on cpu_hotplug_pm_callback</span>
<a name="598" /><span class="True">     598:</span> <span class="k">     * to disable cpu hotplug to avoid cpu hotplug race.</span>
<a name="599" /><span class="True">     599:</span> <span class="k">     */</span>
<a name="600" /><a href="cpu.c.html#600"><span class="True">     600:</span></a>     <a href="cpu.c_macros_ref.html#_cG1fbm90aWZpZXJfMA__"><span class="b">pm_notifier</span></a><span class="f">(</span><span class="b">cpu_hotplug_pm_callback</span><span class="f">,</span> <span class="c">0</span><span class="f">)</span><span class="f">;</span>
<a name="601" /><a href="cpu.c.html#601"><span class="True">     601:</span></a>     <span class="m">return</span> <span class="c">0</span><span class="f">;</span>
<a name="602" /><a href="cpu.c.html#602"><span class="True">     602:</span></a> <span class="f">}</span>
<a name="603" /><a href="cpu.c.html#603"><span class="True">     603:</span></a> <a href="cpu.c_macros_ref.html#_Y29yZV9pbml0Y2FsbF8w"><span class="b">core_initcall</span></a><span class="f">(</span><span class="b">cpu_hotplug_pm_sync_init</span><span class="f">)</span><span class="f">;</span>
<a name="604" /><span class="True">     604:</span> 
<a name="605" /><span class="True">     605:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_PM_SLEEP_SMP */</span>
<a name="606" /><span class="True">     606:</span> 
<a name="607" /><span class="True">     607:</span> <span class="k">/**</span>
<a name="608" /><span class="True">     608:</span> <span class="k"> * notify_cpu_starting(cpu) - call the CPU_STARTING notifiers</span>
<a name="609" /><span class="True">     609:</span> <span class="k"> * @cpu: cpu that just started</span>
<a name="610" /><span class="True">     610:</span> <span class="k"> *</span>
<a name="611" /><span class="True">     611:</span> <span class="k"> * This function calls the cpu_chain notifiers with CPU_STARTING.</span>
<a name="612" /><span class="True">     612:</span> <span class="k"> * It must be called by the arch code on the new cpu, before the new cpu</span>
<a name="613" /><span class="True">     613:</span> <span class="k"> * enables interrupts and before the &quot;boot&quot; cpu returns from __cpu_up().</span>
<a name="614" /><span class="True">     614:</span> <span class="k"> */</span>
<a name="615" /><a href="cpu.c.html#615"><span class="True">     615:</span></a> <span class="m">void</span> <span class="b">notify_cpu_starting</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">)</span>
<a name="616" /><a href="cpu.c.html#616"><span class="True">     616:</span></a> <span class="f">{</span>
<a name="617" /><a href="cpu.c.html#617"><span class="True">     617:</span></a>     <span class="m">unsigned</span> <span class="m">long</span> <span class="b">val</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_Q1BVX1NUQVJUSU5HXzA_"><span class="b">CPU_STARTING</span></a><span class="f">;</span>
<a name="618" /><span class="True">     618:</span> 
<a name="619" /><span class="True">     619:</span> <span class="f">#</span><span class="n">ifdef</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX1BNX1NMRUVQX1NNUF8w"><span class="b">CONFIG_PM_SLEEP_SMP</span></a>
<a name="620" /><a href="cpu.c.html#620"><span class="True">     620:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">frozen_cpus</span> <span class="f">!=</span> <a href="cpu.c_macros_ref.html#_TlVMTF8w"><span class="b">NULL</span></a> <span class="f">&amp;&amp;</span> <a href="cpu.c_macros_ref.html#_Y3B1bWFza190ZXN0X2NwdV8w"><span class="b">cpumask_test_cpu</span></a><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <span class="b">frozen_cpus</span><span class="f">)</span><span class="f">)</span>
<a name="621" /><a href="cpu.c.html#621"><span class="True">     621:</span></a>         <span class="b">val</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_Q1BVX1NUQVJUSU5HX0ZST1pFTl8w"><span class="b">CPU_STARTING_FROZEN</span></a><span class="f">;</span>
<a name="622" /><span class="True">     622:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_PM_SLEEP_SMP */</span>
<a name="623" /><a href="cpu.c.html#623"><span class="True">     623:</span></a>     <span class="b">cpu_notify</span><span class="f">(</span><span class="b">val</span><span class="f">,</span> <span class="f">(</span><span class="m">void</span> <span class="f">*</span><span class="f">)</span><span class="f">(</span><span class="m">long</span><span class="f">)</span><span class="b">cpu</span><span class="f">)</span><span class="f">;</span>
<a name="624" /><a href="cpu.c.html#624"><span class="True">     624:</span></a> <span class="f">}</span>
<a name="625" /><span class="True">     625:</span> 
<a name="626" /><span class="True">     626:</span> <span class="f">#</span><span class="n">endif</span> <span class="k">/* CONFIG_SMP */</span>
<a name="627" /><span class="True">     627:</span> 
<a name="628" /><span class="True">     628:</span> <span class="k">/*</span>
<a name="629" /><span class="True">     629:</span> <span class="k"> * cpu_bit_bitmap[] is a special, &quot;compressed&quot; data structure that</span>
<a name="630" /><span class="True">     630:</span> <span class="k"> * represents all NR_CPUS bits binary values of 1&lt;&lt;nr.</span>
<a name="631" /><span class="True">     631:</span> <span class="k"> *</span>
<a name="632" /><span class="True">     632:</span> <span class="k"> * It is used by cpumask_of() to get a constant address to a CPU</span>
<a name="633" /><span class="True">     633:</span> <span class="k"> * mask value that has a single bit set only.</span>
<a name="634" /><span class="True">     634:</span> <span class="k"> */</span>
<a name="635" /><span class="True">     635:</span> 
<a name="636" /><span class="True">     636:</span> <span class="k">/* cpu_bit_bitmap[0] is empty - so we can back into it */</span>
<a name="637" /><span class="True">     637:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzFfMA__"><span class="b">MASK_DECLARE_1</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <span class="f">[</span><span class="b">x</span><span class="f">+</span><span class="c">1</span><span class="f">]</span><span class="f">[</span><span class="c">0</span><span class="f">]</span> <span class="f">=</span> <span class="f">(</span><span class="c">1UL</span> <span class="f">&lt;&lt;</span> <span class="f">(</span><span class="b">x</span><span class="f">)</span><span class="f">)</span>
<a name="638" /><span class="True">     638:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzJfMA__"><span class="b">MASK_DECLARE_2</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzFfMA__"><span class="b">MASK_DECLARE_1</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzFfMA__"><span class="b">MASK_DECLARE_1</span></a><span class="f">(</span><span class="b">x</span><span class="f">+</span><span class="c">1</span><span class="f">)</span>
<a name="639" /><span class="True">     639:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzRfMA__"><span class="b">MASK_DECLARE_4</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzJfMA__"><span class="b">MASK_DECLARE_2</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzJfMA__"><span class="b">MASK_DECLARE_2</span></a><span class="f">(</span><span class="b">x</span><span class="f">+</span><span class="c">2</span><span class="f">)</span>
<a name="640" /><span class="True">     640:</span> <span class="f">#</span><span class="n">define</span> <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzhfMA__"><span class="b">MASK_DECLARE_8</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span>    <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzRfMA__"><span class="b">MASK_DECLARE_4</span></a><span class="f">(</span><span class="b">x</span><span class="f">)</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzRfMA__"><span class="b">MASK_DECLARE_4</span></a><span class="f">(</span><span class="b">x</span><span class="f">+</span><span class="c">4</span><span class="f">)</span>
<a name="641" /><span class="True">     641:</span> 
<a name="642" /><a href="cpu.c.html#642"><span class="True">     642:</span></a> <span class="m">const</span> <span class="m">unsigned</span> <span class="m">long</span> <span class="b">cpu_bit_bitmap</span><span class="f">[</span><a href="cpu.c_macros_ref.html#_QklUU19QRVJfTE9OR18w"><span class="b">BITS_PER_LONG</span></a><span class="f">+</span><span class="c">1</span><span class="f">]</span><span class="f">[</span><a href="cpu.c_macros_ref.html#_QklUU19UT19MT05HU18w"><span class="b">BITS_TO_LONGS</span></a><span class="f">(</span><a href="cpu.c_macros_ref.html#_TlJfQ1BVU18w"><span class="b">NR_CPUS</span></a><span class="f">)</span><span class="f">]</span> <span class="f">=</span> <span class="f">{</span>
<a name="643" /><span class="True">     643:</span> 
<a name="644" /><a href="cpu.c.html#644"><span class="True">     644:</span></a>     <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzhfMA__"><span class="b">MASK_DECLARE_8</span></a><span class="f">(</span><span class="c">0</span><span class="f">)</span><span class="f">,</span>    <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzhfMA__"><span class="b">MASK_DECLARE_8</span></a><span class="f">(</span><span class="c">8</span><span class="f">)</span><span class="f">,</span>
<a name="645" /><a href="cpu.c.html#645"><span class="True">     645:</span></a>     <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzhfMA__"><span class="b">MASK_DECLARE_8</span></a><span class="f">(</span><span class="c">16</span><span class="f">)</span><span class="f">,</span>    <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzhfMA__"><span class="b">MASK_DECLARE_8</span></a><span class="f">(</span><span class="c">24</span><span class="f">)</span><span class="f">,</span>
<a name="646" /><span class="True">     646:</span> <span class="f">#</span><span class="n">if</span> <a href="cpu.c_macros_ref.html#_QklUU19QRVJfTE9OR18w"><span class="b">BITS_PER_LONG</span></a> <span class="f">&gt;</span> <span class="c">32</span>
<a name="647" /><a href="cpu.c.html#647"><span class="True">     647:</span></a>     <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzhfMA__"><span class="b">MASK_DECLARE_8</span></a><span class="f">(</span><span class="c">32</span><span class="f">)</span><span class="f">,</span>    <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzhfMA__"><span class="b">MASK_DECLARE_8</span></a><span class="f">(</span><span class="c">40</span><span class="f">)</span><span class="f">,</span>
<a name="648" /><a href="cpu.c.html#648"><span class="True">     648:</span></a>     <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzhfMA__"><span class="b">MASK_DECLARE_8</span></a><span class="f">(</span><span class="c">48</span><span class="f">)</span><span class="f">,</span>    <a href="cpu.c_macros_ref.html#_TUFTS19ERUNMQVJFXzhfMA__"><span class="b">MASK_DECLARE_8</span></a><span class="f">(</span><span class="c">56</span><span class="f">)</span><span class="f">,</span>
<a name="649" /><span class="True">     649:</span> <span class="f">#</span><span class="n">endif</span>
<a name="650" /><a href="cpu.c.html#650"><span class="True">     650:</span></a> <span class="f">}</span><span class="f">;</span>
<a name="651" /><a href="cpu.c.html#651"><span class="True">     651:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF9HUExfMA__"><span class="b">EXPORT_SYMBOL_GPL</span></a><span class="f">(</span><span class="b">cpu_bit_bitmap</span><span class="f">)</span><span class="f">;</span>
<a name="652" /><span class="True">     652:</span> 
<a name="653" /><a href="cpu.c.html#653"><span class="True">     653:</span></a> <span class="m">const</span> <a href="cpu.c_macros_ref.html#_REVDTEFSRV9CSVRNQVBfMA__"><span class="b">DECLARE_BITMAP</span></a><span class="f">(</span><span class="b">cpu_all_bits</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_TlJfQ1BVU18w"><span class="b">NR_CPUS</span></a><span class="f">)</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_Q1BVX0JJVFNfQUxMXzA_"><span class="b">CPU_BITS_ALL</span></a><span class="f">;</span>
<a name="654" /><a href="cpu.c.html#654"><span class="True">     654:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF8w"><span class="b">EXPORT_SYMBOL</span></a><span class="f">(</span><span class="b">cpu_all_bits</span><span class="f">)</span><span class="f">;</span>
<a name="655" /><span class="True">     655:</span> 
<a name="656" /><span class="False">     656:</span> <span class="f">#</span><span class="n">ifdef</span> <span class="b">CONFIG_INIT_ALL_POSSIBLE</span>
<a name="657" /><span class="False">     657:</span> <span class="m">static</span> <a href="cpu.c_macros_ref.html#_REVDTEFSRV9CSVRNQVBfMA__"><span class="b">DECLARE_BITMAP</span></a><span class="f">(</span><span class="b">cpu_possible_bits</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX05SX0NQVVNfMA__"><span class="b">CONFIG_NR_CPUS</span></a><span class="f">)</span> <a href="cpu.c_macros_ref.html#_X19yZWFkX21vc3RseV8w"><span class="b">__read_mostly</span></a>
<a name="658" /><span class="False">     658:</span>     <span class="f">=</span> <a href="cpu.c_macros_ref.html#_Q1BVX0JJVFNfQUxMXzA_"><span class="b">CPU_BITS_ALL</span></a><span class="f">;</span>
<a name="659" /><span class="True">     659:</span> <span class="f">#</span><span class="n">else</span>
<a name="660" /><a href="cpu.c.html#660"><span class="True">     660:</span></a> <span class="m">static</span> <a href="cpu.c_macros_ref.html#_REVDTEFSRV9CSVRNQVBfMA__"><span class="b">DECLARE_BITMAP</span></a><span class="f">(</span><span class="b">cpu_possible_bits</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX05SX0NQVVNfMA__"><span class="b">CONFIG_NR_CPUS</span></a><span class="f">)</span> <a href="cpu.c_macros_ref.html#_X19yZWFkX21vc3RseV8w"><span class="b">__read_mostly</span></a><span class="f">;</span>
<a name="661" /><span class="True">     661:</span> <span class="f">#</span><span class="n">endif</span>
<a name="662" /><a href="cpu.c.html#662"><span class="True">     662:</span></a> <span class="m">const</span> <span class="m">struct</span> <span class="b">cpumask</span> <span class="f">*</span><span class="m">const</span> <span class="b">cpu_possible_mask</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_possible_bits</span><span class="f">)</span><span class="f">;</span>
<a name="663" /><a href="cpu.c.html#663"><span class="True">     663:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF8w"><span class="b">EXPORT_SYMBOL</span></a><span class="f">(</span><span class="b">cpu_possible_mask</span><span class="f">)</span><span class="f">;</span>
<a name="664" /><span class="True">     664:</span> 
<a name="665" /><a href="cpu.c.html#665"><span class="True">     665:</span></a> <span class="m">static</span> <a href="cpu.c_macros_ref.html#_REVDTEFSRV9CSVRNQVBfMA__"><span class="b">DECLARE_BITMAP</span></a><span class="f">(</span><span class="b">cpu_online_bits</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX05SX0NQVVNfMA__"><span class="b">CONFIG_NR_CPUS</span></a><span class="f">)</span> <a href="cpu.c_macros_ref.html#_X19yZWFkX21vc3RseV8w"><span class="b">__read_mostly</span></a><span class="f">;</span>
<a name="666" /><a href="cpu.c.html#666"><span class="True">     666:</span></a> <span class="m">const</span> <span class="m">struct</span> <span class="b">cpumask</span> <span class="f">*</span><span class="m">const</span> <span class="b">cpu_online_mask</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_online_bits</span><span class="f">)</span><span class="f">;</span>
<a name="667" /><a href="cpu.c.html#667"><span class="True">     667:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF8w"><span class="b">EXPORT_SYMBOL</span></a><span class="f">(</span><span class="b">cpu_online_mask</span><span class="f">)</span><span class="f">;</span>
<a name="668" /><span class="True">     668:</span> 
<a name="669" /><a href="cpu.c.html#669"><span class="True">     669:</span></a> <span class="m">static</span> <a href="cpu.c_macros_ref.html#_REVDTEFSRV9CSVRNQVBfMA__"><span class="b">DECLARE_BITMAP</span></a><span class="f">(</span><span class="b">cpu_present_bits</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX05SX0NQVVNfMA__"><span class="b">CONFIG_NR_CPUS</span></a><span class="f">)</span> <a href="cpu.c_macros_ref.html#_X19yZWFkX21vc3RseV8w"><span class="b">__read_mostly</span></a><span class="f">;</span>
<a name="670" /><a href="cpu.c.html#670"><span class="True">     670:</span></a> <span class="m">const</span> <span class="m">struct</span> <span class="b">cpumask</span> <span class="f">*</span><span class="m">const</span> <span class="b">cpu_present_mask</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_present_bits</span><span class="f">)</span><span class="f">;</span>
<a name="671" /><a href="cpu.c.html#671"><span class="True">     671:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF8w"><span class="b">EXPORT_SYMBOL</span></a><span class="f">(</span><span class="b">cpu_present_mask</span><span class="f">)</span><span class="f">;</span>
<a name="672" /><span class="True">     672:</span> 
<a name="673" /><a href="cpu.c.html#673"><span class="True">     673:</span></a> <span class="m">static</span> <a href="cpu.c_macros_ref.html#_REVDTEFSRV9CSVRNQVBfMA__"><span class="b">DECLARE_BITMAP</span></a><span class="f">(</span><span class="b">cpu_active_bits</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_Q09ORklHX05SX0NQVVNfMA__"><span class="b">CONFIG_NR_CPUS</span></a><span class="f">)</span> <a href="cpu.c_macros_ref.html#_X19yZWFkX21vc3RseV8w"><span class="b">__read_mostly</span></a><span class="f">;</span>
<a name="674" /><a href="cpu.c.html#674"><span class="True">     674:</span></a> <span class="m">const</span> <span class="m">struct</span> <span class="b">cpumask</span> <span class="f">*</span><span class="m">const</span> <span class="b">cpu_active_mask</span> <span class="f">=</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_active_bits</span><span class="f">)</span><span class="f">;</span>
<a name="675" /><a href="cpu.c.html#675"><span class="True">     675:</span></a> <a href="cpu.c_macros_ref.html#_RVhQT1JUX1NZTUJPTF8w"><span class="b">EXPORT_SYMBOL</span></a><span class="f">(</span><span class="b">cpu_active_mask</span><span class="f">)</span><span class="f">;</span>
<a name="676" /><span class="True">     676:</span> 
<a name="677" /><a href="cpu.c.html#677"><span class="True">     677:</span></a> <span class="m">void</span> <span class="b">set_cpu_possible</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">,</span> <span class="m">bool</span> <span class="b">possible</span><span class="f">)</span>
<a name="678" /><a href="cpu.c.html#678"><span class="True">     678:</span></a> <span class="f">{</span>
<a name="679" /><a href="cpu.c.html#679"><span class="True">     679:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">possible</span><span class="f">)</span>
<a name="680" /><a href="cpu.c.html#680"><span class="True">     680:</span></a>         <span class="b">cpumask_set_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_possible_bits</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="681" /><a href="cpu.c.html#681"><span class="True">     681:</span></a>     <span class="m">else</span>
<a name="682" /><a href="cpu.c.html#682"><span class="True">     682:</span></a>         <span class="b">cpumask_clear_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_possible_bits</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="683" /><a href="cpu.c.html#683"><span class="True">     683:</span></a> <span class="f">}</span>
<a name="684" /><span class="True">     684:</span> 
<a name="685" /><a href="cpu.c.html#685"><span class="True">     685:</span></a> <span class="m">void</span> <span class="b">set_cpu_present</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">,</span> <span class="m">bool</span> <span class="b">present</span><span class="f">)</span>
<a name="686" /><a href="cpu.c.html#686"><span class="True">     686:</span></a> <span class="f">{</span>
<a name="687" /><a href="cpu.c.html#687"><span class="True">     687:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">present</span><span class="f">)</span>
<a name="688" /><a href="cpu.c.html#688"><span class="True">     688:</span></a>         <span class="b">cpumask_set_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_present_bits</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="689" /><a href="cpu.c.html#689"><span class="True">     689:</span></a>     <span class="m">else</span>
<a name="690" /><a href="cpu.c.html#690"><span class="True">     690:</span></a>         <span class="b">cpumask_clear_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_present_bits</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="691" /><a href="cpu.c.html#691"><span class="True">     691:</span></a> <span class="f">}</span>
<a name="692" /><span class="True">     692:</span> 
<a name="693" /><a href="cpu.c.html#693"><span class="True">     693:</span></a> <span class="m">void</span> <span class="b">set_cpu_online</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">,</span> <span class="m">bool</span> <span class="b">online</span><span class="f">)</span>
<a name="694" /><a href="cpu.c.html#694"><span class="True">     694:</span></a> <span class="f">{</span>
<a name="695" /><a href="cpu.c.html#695"><span class="True">     695:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">online</span><span class="f">)</span>
<a name="696" /><a href="cpu.c.html#696"><span class="True">     696:</span></a>         <span class="b">cpumask_set_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_online_bits</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="697" /><a href="cpu.c.html#697"><span class="True">     697:</span></a>     <span class="m">else</span>
<a name="698" /><a href="cpu.c.html#698"><span class="True">     698:</span></a>         <span class="b">cpumask_clear_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_online_bits</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="699" /><a href="cpu.c.html#699"><span class="True">     699:</span></a> <span class="f">}</span>
<a name="700" /><span class="True">     700:</span> 
<a name="701" /><a href="cpu.c.html#701"><span class="True">     701:</span></a> <span class="m">void</span> <span class="b">set_cpu_active</span><span class="f">(</span><span class="m">unsigned</span> <span class="m">int</span> <span class="b">cpu</span><span class="f">,</span> <span class="m">bool</span> <span class="b">active</span><span class="f">)</span>
<a name="702" /><a href="cpu.c.html#702"><span class="True">     702:</span></a> <span class="f">{</span>
<a name="703" /><a href="cpu.c.html#703"><span class="True">     703:</span></a>     <span class="m">if</span> <span class="f">(</span><span class="b">active</span><span class="f">)</span>
<a name="704" /><a href="cpu.c.html#704"><span class="True">     704:</span></a>         <span class="b">cpumask_set_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_active_bits</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="705" /><a href="cpu.c.html#705"><span class="True">     705:</span></a>     <span class="m">else</span>
<a name="706" /><a href="cpu.c.html#706"><span class="True">     706:</span></a>         <span class="b">cpumask_clear_cpu</span><span class="f">(</span><span class="b">cpu</span><span class="f">,</span> <a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_active_bits</span><span class="f">)</span><span class="f">)</span><span class="f">;</span>
<a name="707" /><a href="cpu.c.html#707"><span class="True">     707:</span></a> <span class="f">}</span>
<a name="708" /><span class="True">     708:</span> 
<a name="709" /><a href="cpu.c.html#709"><span class="True">     709:</span></a> <span class="m">void</span> <span class="b">init_cpu_present</span><span class="f">(</span><span class="m">const</span> <span class="m">struct</span> <span class="b">cpumask</span> <span class="f">*</span><span class="b">src</span><span class="f">)</span>
<a name="710" /><a href="cpu.c.html#710"><span class="True">     710:</span></a> <span class="f">{</span>
<a name="711" /><a href="cpu.c.html#711"><span class="True">     711:</span></a>     <span class="b">cpumask_copy</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_present_bits</span><span class="f">)</span><span class="f">,</span> <span class="b">src</span><span class="f">)</span><span class="f">;</span>
<a name="712" /><a href="cpu.c.html#712"><span class="True">     712:</span></a> <span class="f">}</span>
<a name="713" /><span class="True">     713:</span> 
<a name="714" /><a href="cpu.c.html#714"><span class="True">     714:</span></a> <span class="m">void</span> <span class="b">init_cpu_possible</span><span class="f">(</span><span class="m">const</span> <span class="m">struct</span> <span class="b">cpumask</span> <span class="f">*</span><span class="b">src</span><span class="f">)</span>
<a name="715" /><a href="cpu.c.html#715"><span class="True">     715:</span></a> <span class="f">{</span>
<a name="716" /><a href="cpu.c.html#716"><span class="True">     716:</span></a>     <span class="b">cpumask_copy</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_possible_bits</span><span class="f">)</span><span class="f">,</span> <span class="b">src</span><span class="f">)</span><span class="f">;</span>
<a name="717" /><a href="cpu.c.html#717"><span class="True">     717:</span></a> <span class="f">}</span>
<a name="718" /><span class="True">     718:</span> 
<a name="719" /><a href="cpu.c.html#719"><span class="True">     719:</span></a> <span class="m">void</span> <span class="b">init_cpu_online</span><span class="f">(</span><span class="m">const</span> <span class="m">struct</span> <span class="b">cpumask</span> <span class="f">*</span><span class="b">src</span><span class="f">)</span>
<a name="720" /><a href="cpu.c.html#720"><span class="True">     720:</span></a> <span class="f">{</span>
<a name="721" /><a href="cpu.c.html#721"><span class="True">     721:</span></a>     <span class="b">cpumask_copy</span><span class="f">(</span><a href="cpu.c_macros_ref.html#_dG9fY3B1bWFza18w"><span class="b">to_cpumask</span></a><span class="f">(</span><span class="b">cpu_online_bits</span><span class="f">)</span><span class="f">,</span> <span class="b">src</span><span class="f">)</span><span class="f">;</span>
<a name="722" /><a href="cpu.c.html#722"><span class="True">     722:</span></a> <span class="f">}</span>
<a name="723" /><a href="cpu.c.html#723"><span class="True">     723:</span></a> </pre>
  </body>
</html>
